:root {
  --line: #d0d7de; --line2: #eaeef2; --muted: #57606a; --blue: #1f6feb; --bg: #f6f8fa;
  --ok: #1a7f37; --err: #cf222e; --sel: #ddf4ff; --row: 26px;
  --panel: #fff; --text: #1f2328; --bg2: #f3f5f7; --canvas: #e9ecef; --link: #0969da; --panel-a: rgba(255,255,255,.93);
  --warnbg: #fff8c5; --tint: #f5faff;
}
/* Nen toi (nut ☾ tren dau trang) */
html.dark {
  --line: #3d444d; --line2: #2a3038; --muted: #9198a1; --blue: #2f81f7; --bg: #0d1117;
  --ok: #3fb950; --err: #f85149; --sel: #1c3557;
  --panel: #161b22; --text: #e6edf3; --bg2: #1c2128; --canvas: #22272e; --link: #58a6ff; --panel-a: rgba(22,27,34,.93);
  --warnbg: #3a2f0b; --tint: #132235;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; font-size: 13px; color: var(--text); background: var(--bg); }
a { color: var(--link); }
button { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.on { background: var(--sel); border-color: #54aeff; color: var(--link); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=date], input[type=search], input[type=number], select { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: var(--panel); color: var(--text); }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line2); padding: 4px 7px; text-align: left; vertical-align: top; }
th { background: var(--bg); font-weight: 600; }
td.num, th.num { text-align: right; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.err { color: var(--err); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.chip { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.15); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eaeef2; }
.pill.proposed { background: var(--warnbg); }
.pill.approved { background: #dafbe1; }

/* ---------------- khung trang */
header { height: 48px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 14px; display: flex; align-items: center; gap: 16px; }
header h1 { font-size: 15px; margin: 0; white-space: nowrap; }
#search-wrap { position: relative; flex: 0 1 420px; }
#q { width: 100%; padding: 6px 10px; }
#suggest { position: absolute; top: 34px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); z-index: 50; max-height: 420px; overflow: auto; display: none; }
#suggest .grp { padding: 4px 10px; font-size: 11.5px; color: var(--muted); background: var(--bg); }
#suggest .it { padding: 5px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
#suggest .it:hover, #suggest .it.act { background: var(--sel); }
nav { display: flex; gap: 4px; flex-shrink: 0; }
nav button { border: none; background: none; padding: 6px 12px; color: var(--muted); white-space: nowrap; }
nav button.active { background: var(--sel); color: var(--link); font-weight: 600; }
#datadate { margin-left: auto; color: var(--muted); white-space: nowrap; }

#app { height: calc(100% - 48px); display: flex; }
#sidebar { width: 270px; flex: 0 0 270px; background: var(--panel); border-right: 1px solid var(--line); overflow: auto; padding: 10px 12px; }
#content { flex: 1; overflow: auto; min-width: 0; }
#card td { word-break: break-word; }
.tab { display: none; height: 100%; }
.tab.active { display: block; }

/* ---------------- bo loc */
.fhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.fhead b { font-size: 13.5px; }
#fsummary { font-size: 12px; margin: 4px 0 8px; }
.facet { border-top: 1px solid var(--line2); padding: 7px 0; }
.facet > .t { display: flex; justify-content: space-between; cursor: pointer; font-weight: 600; }
.facet > .t .n { color: var(--link); font-weight: 600; }
.facet .body { margin-top: 5px; }
.facet .opts { max-height: 190px; overflow: auto; }
.facet label { display: flex; gap: 6px; align-items: flex-start; padding: 1.5px 0; cursor: pointer; }
.facet label .c { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.facet label.zero { opacity: .45; }
.facet input[type=search] { width: 100%; margin-bottom: 4px; }
.facet.closed .body { display: none; }
.saved { border-top: 1px solid var(--line2); padding-top: 8px; margin-top: 4px; }
.saved .it { display: flex; justify-content: space-between; padding: 2px 0; }
.saved .it a { cursor: pointer; }

/* ---------------- tab Lam viec */
#work { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(160px, var(--wtop, 46%)) 10px minmax(0, 1fr); gap: 0; padding: 6px 10px 10px; height: 100%; }
#work-top { display: grid; grid-template-columns: minmax(0, var(--c1, 1fr)) 10px minmax(0, var(--c2, 1fr)) 10px var(--c3, 360px); gap: 0; min-height: 0; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; min-height: 0; }
.panel h3 { font-size: 13.5px; margin: 0 0 8px; }
.placeholder { height: calc(100% - 26px); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 10px, var(--bg2) 10px, var(--bg2) 20px); border-radius: 6px; padding: 10px; }
#card .kv td:first-child { color: var(--muted); width: 42%; }
#card .tl td { padding: 3px 6px; }
#card .members { margin-top: 8px; }
#card .members tr { cursor: pointer; }
#card .members tr:hover td { background: var(--sel); }
#card .members tr.me td { font-weight: 600; }
#card .slow { color: var(--err); }

#tablebox { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
#tbar { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
#tbar .count { font-weight: 600; }
#textfilter { display: none; }
#grpfilter { display: none; }
#grpfilter.on { display: inline-flex; gap: 6px; align-items: center; background: #e0f7fa; padding: 2px 8px; border-radius: 10px; }
#card .gbtn { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
#card .gbtn button { padding: 2px 8px; font-size: 12px; }
#card .dwgs td { cursor: pointer; }
#card .dwgs tr:hover td { background: var(--sel); }
#textfilter.on { display: inline-flex; gap: 6px; align-items: center; background: var(--sel); padding: 2px 8px; border-radius: 10px; }
#colmenu { position: absolute; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; box-shadow: 0 6px 18px rgba(0,0,0,.12); z-index: 40; display: none; max-height: 360px; overflow: auto; }
#colmenu label { display: block; padding: 2px 0; white-space: nowrap; }
#grid { flex: 1; overflow: auto; position: relative; min-height: 120px; }
#grid .thead { position: sticky; top: 0; z-index: 2; display: flex; background: var(--bg); border-bottom: 1px solid var(--line); min-width: max-content; }
#grid .th { padding: 5px 7px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line2); user-select: none; }
#grid .th .arr { color: var(--link); }
#grid .tbody { position: relative; min-width: max-content; }
#grid .tr { position: absolute; left: 0; right: 0; height: var(--row); display: flex; border-bottom: 1px solid var(--line2); cursor: pointer; min-width: max-content; }
#grid .tr:hover { background: var(--bg); }
#grid .tr.sel { background: var(--sel); }
#grid .td { padding: 4px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line2); }
#grid .td.num { text-align: right; }

/* ---------------- Dashboard */
#dash { padding: 12px; }
#dash .bar-top { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
#tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.tile .nm { font-size: 12px; color: var(--muted); display: flex; align-items: center; }
.tile .v { font-size: 21px; font-weight: 600; margin: 2px 0; }
.tile .s { font-size: 11.5px; color: var(--muted); }
.tile.total { border-color: #54aeff; background: var(--tint); }
.tile .mini { height: 5px; background: var(--line2); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.tile .mini > div { height: 100%; }
#charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.chart h3 { font-size: 13.5px; margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ---------------- tab Du lieu */
#datatab { max-width: 1280px; margin: 0 auto; padding: 14px 16px 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#datatab section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
#datatab section.wide { grid-column: 1 / -1; }
#datatab h2 { font-size: 14px; margin: 0 0 10px; }
#datatab .kv td:first-child { color: var(--muted); width: 44%; }
#datatab .scroll { max-height: 460px; overflow: auto; }
#datatab h3.grpH { font-size: 13px; margin: 14px 0 6px; }
#grpRows td, #grpLeft td { white-space: normal; }
#grpRows td.nodes { font-family: Consolas, monospace; font-size: 12px; }
#grpRows td.act { white-space: nowrap; }
#grpRows td.act button, #grpLeft td button { padding: 1px 7px; font-size: 12px; }
#grpRows tr.st-approved td.stc { color: var(--ok); font-weight: 600; }
#grpRows tr.st-rejected td { color: var(--muted); }
#grpRows tr.st-rejected td.stc { color: var(--err); }
#grpRows input.gnodes, #grpLeft input.gnodes { width: 100%; min-width: 260px; font-family: Consolas, monospace; font-size: 12px; }
.pbar { height: 8px; background: var(--line2); border-radius: 4px; overflow: hidden; min-width: 80px; }
.pbar > div { height: 100%; background: var(--blue); }

/* ---------------- Drawing Viewer */
#dv { display: flex; flex-direction: column; overflow: hidden; position: relative; padding: 8px 10px; }
#dv .dvbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
#dv .dvbar h3 { margin: 0 6px 0 0; }
#dv .dvbar button { padding: 2px 8px; }
#dvTypes { display: inline-flex; gap: 3px; }
#dvTypes .cnt { font-size: 11px; color: var(--muted); }
#dvTypes button.on .cnt { color: var(--link); }
#dvPages, #dvOcc { white-space: nowrap; font-size: 12px; }
#dvInfo { font-size: 12px; margin-bottom: 4px; line-height: 1.45; }
#dvView { flex: 1; min-height: 0; overflow: auto; position: relative; background: var(--canvas); border-radius: 6px; cursor: default; user-select: none; }
#dvView.grab { cursor: grabbing; }
#dvMsg { height: 100%; }
#dvPage { position: relative; background: var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
#dvPage canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#dvOver { position: absolute; inset: 0; z-index: 2; }
.dvb { position: absolute; cursor: pointer; border: 1px solid transparent; border-radius: 2px; }
.dvb:hover { border-color: #1f6feb; background: rgba(31, 111, 235, .12); }
.dvb.hl { border: 2px solid #cf222e; background: rgba(255, 213, 0, .35); }
.dvb.act { border: 3px solid #ff6a00; box-shadow: 0 0 0 3px rgba(255, 106, 0, .35); }
#dvPick { position: absolute; display: none; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 6px 0; min-width: 220px; max-height: 260px; overflow: auto; }
#dvPick .muted { padding: 2px 10px 4px; font-size: 12px; }
#dvPick .it { padding: 4px 10px; cursor: pointer; }
#dvPick .it:hover { background: var(--sel); }
.dvb.dvp { border-radius: 0; }
.dvb.dvm { border-radius: 0; border: 1px solid; pointer-events: auto; }
.dvb.dvm.sel { border-width: 2px; }
#dvOver svg.dvsvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#dvOver svg.dvsvg polygon { pointer-events: visiblePainted; cursor: pointer; }
.dvb.dvm.act { box-shadow: 0 0 0 3px rgba(255, 106, 0, .35); }
.dvb.dvp.hl { border: 2px solid #cf222e; background: rgba(255, 213, 0, .45); }
.dvb.dvp.act { border: 3px solid #ff6a00; background: rgba(255, 170, 0, .40); box-shadow: 0 0 0 3px rgba(255, 106, 0, .35); }

/* ---------------- Theo doi (Phase 3.5) */
#watch { padding: 12px; height: 100%; display: flex; flex-direction: column; box-sizing: border-box; }
#watch .bar-top { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
#wCtl { display: inline-flex; gap: 8px; align-items: center; font-size: 12.5px; }
#wNote { margin-bottom: 6px; font-size: 12.5px; }
#wTable { flex: 1; min-height: 0; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table.wt { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.wt th { position: sticky; top: 0; background: var(--bg); text-align: left; font-weight: 600; padding: 5px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
table.wt td { padding: 4px 7px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
table.wt td.num { text-align: right; }
table.wt a.pm { cursor: pointer; color: var(--link); }
table.wt a.pm:hover { text-decoration: underline; }
table.wt tr.asm { cursor: pointer; }
table.wt tr.asm:hover td { background: var(--bg); }
table.wt tr.sub td { background: var(--bg2); padding-left: 28px; }
.st-ready { color: var(--ok); font-weight: 600; }
.warn { margin: 6px 0 2px; padding: 6px 8px; background: var(--warnbg); border: 1px solid #d4a72c; border-radius: 6px; font-size: 12px; }
.warn div { margin: 2px 0; cursor: pointer; }
.warn div:hover { text-decoration: underline; }

/* ---------------- Mini schedule (Phase 3.6) */
.wview { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#msPick { display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; max-height: 260px; overflow: auto; font-size: 12.5px; }
#msPick label { display: block; padding: 2px 0; }
#msPick .muted { margin-left: 4px; }
#msNote { margin-bottom: 6px; font-size: 12.5px; }
#msTable { flex: 1 1 55%; min-height: 120px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
#msKpi { flex: 1 1 45%; min-height: 0; overflow: auto; margin-top: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: none; }
table.ms { border-collapse: collapse; font-size: 12px; }
table.ms th { position: sticky; background: var(--bg); font-weight: 600; padding: 4px 5px; border: 1px solid var(--line2); white-space: nowrap; z-index: 1; }
table.ms tr.h1 th { top: 0; }
table.ms tr.h2 th { top: 24px; }
table.ms td { padding: 2px 5px; border: 1px solid var(--line2); white-space: nowrap; }
table.ms td.num { text-align: right; }
table.ms td.nm { min-width: 230px; cursor: pointer; }
table.ms tr.sel td { background: var(--sel); }
table.ms tr.man td.nm { font-style: italic; }
table.ms input.txt.dt { width: 78px; }
table.ms input.txt { font-size: 12px; width: 110px; border: 1px solid transparent; background: transparent; }
table.ms input.txt.wide { width: 220px; }
table.ms input.txt:hover, table.ms input.txt:focus { border-color: var(--line); background: var(--panel); }
table.ms .act button { padding: 0 5px; font-size: 11px; }
.s-done { color: var(--ok); font-weight: 600; }
.s-late { color: var(--err); font-weight: 600; }
.s-slow { color: #bc4c00; font-weight: 600; }
.s-ok { color: var(--link); }
.s-none { color: var(--muted); }
#msKpi h3 { margin: 0 0 6px; font-size: 13.5px; }
#msKpi svg { width: 100%; max-width: 980px; height: auto; display: block; }
table.kw { border-collapse: collapse; font-size: 11.5px; margin-top: 6px; }
table.kw th, table.kw td { border: 1px solid var(--line2); padding: 2px 5px; white-space: nowrap; text-align: right; }
table.kw th:first-child, table.kw td:first-child, table.kw td:nth-child(2) { text-align: left; }
table.kw tr.tot td { font-weight: 600; background: var(--bg); }

/* ---------------- 3D (Phase 4) */
#m3 { display: flex; flex-direction: column; overflow: hidden; position: relative; padding: 8px 10px; }
#m3 .m3bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; font-size: 12px; }
#m3 .m3bar h3 { margin: 0 6px 0 0; }
#m3 .m3bar button, #m3 .m3bar select { padding: 2px 6px; font-size: 12px; }
#m3Cut { width: 90px; vertical-align: middle; }
#m3CutZ { width: 64px; font-size: 12px; padding: 1px 3px; }
#m3CutLv { max-width: 150px; }
#m3Areas .tg { display: inline-block; width: 14px; cursor: pointer; color: var(--muted); user-select: none; }
#m3Areas .kids { display: none; }
#m3Areas .open > .kids { display: block; }
#m3Info { font-size: 12px; min-height: 16px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#m3Box { flex: 1; min-height: 0; position: relative; border-radius: 6px; overflow: hidden; background: var(--canvas); }
#m3View { position: absolute; inset: 0; }
#m3Msg { position: absolute; inset: 0; height: auto; z-index: 3; }
#m3Areas { position: absolute; display: none; z-index: 60; left: 10px; top: 36px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 8px 10px; max-height: 70%; overflow: auto; font-size: 12px; min-width: 240px; }
#m3Areas label { display: block; padding: 1px 0; white-space: nowrap; }
#m3Areas .sub { margin-left: 18px; }
#m3Legend { position: absolute; top: 6px; right: 6px; z-index: 4; background: var(--panel-a); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 11.5px; line-height: 1.55; max-width: 300px; }
#m3Legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 5px; border: 1px solid rgba(0,0,0,.15); }

/* ---------------- Phong to khung 3D / ban ve */
#m3.maxed, #dv.maxed { position: fixed; top: 56px; left: 10px; right: 10px; bottom: 10px; z-index: 900; box-shadow: 0 10px 34px rgba(0,0,0,.28); }
#pmaxBack { display: none; position: fixed; inset: 0; z-index: 899; background: rgba(15, 23, 42, .28); }
#pmaxBack.on { display: block; }
button.pmax { white-space: nowrap; }

/* ---------------- Nen toi: bieu do SVG ve san mau chu / nen sang */
html.dark svg text[fill="#1f2328"], html.dark svg tspan[fill="#1f2328"] { fill: var(--text); }
html.dark svg text[fill="#57606a"], html.dark svg tspan[fill="#57606a"] { fill: var(--muted); }
html.dark svg rect[fill="#f3f5f7"], html.dark svg rect[fill="#f6f8fa"] { fill: var(--bg2); }
html.dark svg line[stroke="#eaeef2"], html.dark svg line[stroke="#d0d7de"] { stroke: var(--line2); }
html.dark .pill { background: var(--bg2); }
html.dark .pill.proposed { background: #3a2f0b; }
html.dark .pill.approved { background: #12361f; }
html.dark #grpfilter.on { background: #0f3a40; }
html.dark .warn { border-color: #9e6a03; }
html.dark #grid .tr:hover { background: var(--bg2); }
html.dark table.wt tr.asm:hover td { background: var(--bg2); }

/* ---------------- Thanh chia keo duoc (Lam viec) */
.split { position: relative; z-index: 5; }
.split.v { cursor: col-resize; }
.split.h { cursor: row-resize; }
.split::after { content: ""; position: absolute; border-radius: 2px; background: transparent; transition: background .15s; }
.split.v::after { left: 3px; right: 3px; top: 30%; bottom: 30%; }
.split.h::after { top: 3px; bottom: 3px; left: 40%; right: 40%; }
.split:hover::after, .split.drag::after { background: var(--blue); opacity: .55; }
body.splitting { user-select: none; }
body.splitting iframe, body.splitting canvas { pointer-events: none; }

/* ---------------- Dai chu giai mau cong doan */
#stageLegend { display: flex; flex-wrap: wrap; gap: 3px 12px; align-items: center; font-size: 11.5px; color: var(--muted); padding: 0 2px 6px; }
#stageLegend .chip { width: 11px; height: 11px; }
#stageLegend .sep { width: 1px; height: 12px; background: var(--line); }

/* ---------------- Dau trang: trang thai du lieu, nut */
#hstatus { margin-left: auto; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
#hstatus .st { display: inline-flex; gap: 5px; align-items: center; padding: 2px 9px; border-radius: 11px; font-size: 12px; background: var(--bg2); border: 1px solid var(--line2); color: var(--text); cursor: default; }
#hstatus .st i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }
#hstatus .st.warn2 { background: var(--warnbg); border-color: #d4a72c; }
#hstatus .st.warn2 i { background: #d4a72c; }
#hstatus .st.bad i { background: var(--err); }
#datadate { margin-left: 0; }
#datadate:empty { display: none; }
.hbtn { border: none; background: none; font-size: 16px; padding: 3px 7px; color: var(--muted); }
.hbtn:hover { background: var(--bg2); color: var(--text); }
#helpBox { display: none; position: fixed; right: 16px; top: 56px; z-index: 950; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 10px 14px; width: 380px; }
#helpBox.on { display: block; }
#helpBox h3 { margin: 0 0 6px; font-size: 13.5px; }
#helpBox td { border: none; padding: 3px 6px; }
kbd { display: inline-block; min-width: 18px; text-align: center; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--bg2); font: 12px Consolas, monospace; }

/* ---------------- The piece: thanh buoc cong doan */
.stepper { display: grid; grid-template-columns: repeat(8, 1fr); margin: 6px 0 2px; position: relative; }
.stepper .sp { text-align: center; position: relative; font-size: 10.5px; line-height: 1.25; padding-top: 22px; color: var(--muted); }
.stepper .sp::before { content: ""; position: absolute; top: 8px; left: -50%; right: 50%; height: 3px; background: var(--line2); }
.stepper .sp:first-child::before { display: none; }
.stepper .sp.done::before { background: var(--c); }
.stepper .sp .dot { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); box-sizing: border-box; z-index: 1; }
.stepper .sp.done .dot { background: var(--c); border-color: var(--c); }
.stepper .sp.next .dot { border-color: var(--c); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
.stepper .sp .nm { color: var(--text); font-weight: 600; }
.stepper .sp .dt { white-space: nowrap; }

/* ---------------- Bang piece: cot co dinh, dong canh bao, do day dong */
#grid .td.stk, #grid .th.stk { position: sticky; left: 0; z-index: 1; background: var(--panel); }
#grid .th.stk { background: var(--bg); z-index: 3; }
#grid .tr:hover .td.stk { background: var(--bg2); }
#grid .tr.sel .td.stk { background: var(--sel); }
#grid .tr.sel { background: var(--sel); }
#grid .tr.wrow .td.stk { box-shadow: inset 3px 0 0 var(--err); }
#grid .td .wi { color: var(--err); margin-right: 4px; }
#grid.dense { --row: 21px; font-size: 12px; }
#grid.dense .td { padding: 2px 7px; }

/* ---------------- 3D: menu cong cu */
#m3Tools { position: absolute; display: none; z-index: 60; left: 10px; top: 36px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 8px 10px; font-size: 12px; min-width: 320px; }
#m3Tools.on { display: block; }
#m3Tools .trow { display: flex; gap: 6px; align-items: center; padding: 4px 0; flex-wrap: wrap; }
#m3Tools .tl { width: 72px; color: var(--muted); }
#m3ToolsBtn.act { border-color: #54aeff; color: var(--link); font-weight: 600; }

/* ---------------- Ban ve o cua so rieng */
#dvPopped { display: none; position: absolute; inset: 40px 10px 10px; z-index: 70; align-items: center; justify-content: center; text-align: center; color: var(--muted); background: var(--panel); border-radius: 6px; }
#dv.popped #dvPopped { display: flex; }
#dv.popped #dvPopped button { margin-top: 8px; }
html.popout header, html.popout #sidebar, html.popout #stageLegend, html.popout .split, html.popout #m3, html.popout #card,
html.popout #tablebox, html.popout button.pmax, html.popout #dvPopBtn, html.popout #helpBox { display: none !important; }
html.popout #app { height: 100%; }
html.popout #dv { position: fixed; inset: 0; border-radius: 0; border: none; z-index: 10; }

/* ---------------- Dashboard nang cap */
#tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { padding: 12px 14px; }
.tile .v { font-size: 27px; }
.tile.total .v { font-size: 30px; }
.chart .bar { cursor: pointer; }
.chart .bar:hover rect:last-of-type { opacity: .8; }
.chart .click { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- ten, logo, slogan tren dau trang ---------- */
header .brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
header .brand img { height: 42px; width: 42px; object-fit: contain; display: block; }
header .brand h1 { line-height: 1.15; }
header .slogan { font-size: 11px; font-style: italic; color: var(--muted); white-space: nowrap; line-height: 1.2;
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- man hinh khoi dong ---------- */
#splash { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, var(--panel) 0%, var(--bg) 75%); transition: opacity .45s ease; }
#splash.out { opacity: 0; pointer-events: none; }
#splash .sp-box { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(440px, 86vw); }
#splash img { width: min(340px, 70vw, 52vh); height: auto; display: block; animation: spIn .6s ease-out both; }
#splash .sp-slogan { font-size: 19px; font-weight: 700; font-style: italic; color: var(--text); text-align: center; animation: spIn .6s .15s ease-out both; }
#splash .sp-bar { width: 100%; height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; }
#splash .sp-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #f59e0b, #facc15);
  animation: spLoad 6s cubic-bezier(.15,.7,.3,1) forwards; }
#splash .sp-msg { font-size: 12px; color: var(--muted); }
#splash .sp-msg.err { color: var(--err); }
@keyframes spLoad { from { width: 0; } to { width: 92%; } }
@keyframes spIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
html.popout #splash { display: none !important; }

/* ---------- dang nhap va phan quyen (Phase 5a) ---------- */
html.role-viewer .admin-only { display: none !important; }
html.role-viewer #msTable td.act button { display: none; }
html.role-viewer #msTable input { border-color: transparent; background: transparent; }
#btnUser { font-size: 12.5px; white-space: nowrap; color: var(--text); display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
#meName { max-width: 130px; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
#userMenu .um-head { padding: 6px 10px 8px; border-bottom: 1px solid var(--line2); margin-bottom: 4px; }
#userMenu { display: none; position: fixed; right: 12px; top: 46px; z-index: 960; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 4px; min-width: 180px; }
#userMenu.on { display: block; }
#userMenu button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 7px 10px; }
#userMenu button:hover { background: var(--bg2); }
#dlgBack { display: none; position: fixed; inset: 0; z-index: 10001; background: rgba(0,0,0,.35); }
#dlgBack.on { display: block; }
.dlg { display: none; position: fixed; z-index: 10002; left: 50%; top: 12vh; transform: translateX(-50%); width: min(420px, 94vw);
  max-height: 80vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,.3); padding: 14px 18px; }
.dlg.on { display: block; }
.dlg.wide { width: min(1000px, 96vw); }
.dlg h3 { margin: 0 0 8px; font-size: 15px; }
.dlg h4 { margin: 14px 0 4px; font-size: 13.5px; }
.dlg label { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; }
.dlg input[type=password] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: var(--panel); color: var(--text); }
table.usr td { vertical-align: middle; white-space: nowrap; }
table.usr td input[type=text] { width: 100%; min-width: 140px; }
table.usr td.act button { margin-right: 4px; }
table.usr tr.locked td { opacity: .6; }
code.pwshow { font-size: 14px; padding: 1px 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; user-select: all; }

body.loginpage { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(circle at 50% 30%, var(--panel) 0%, var(--bg) 75%); }
.lg-box { width: min(380px, 94vw); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lg-logo { width: min(230px, 60vw); height: auto; display: block; }
.lg-slogan { font-size: 15px; font-weight: 700; font-style: italic; text-align: center; }
.lg-form { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.lg-form h2 { margin: 0; font-size: 16px; }
.lg-form label { display: flex; flex-direction: column; gap: 4px; }
.lg-form input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 16px;
  background: var(--panel); color: var(--text); }
.lg-form button { padding: 9px; font-size: 15px; }
.lg-msg:empty, .lg-note:empty { display: none; }

/* ---------- sao luu va nhat ky (Phase 5b) ---------- */
#bkTable tr.today td { background: var(--tint); }
pre.logbox { max-height: 360px; overflow: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; font: 12px/1.45 Consolas, "Courier New", monospace; white-space: pre-wrap; margin: 6px 0 0; }
pre.logbox .lw { color: #9a6700; }
html.dark pre.logbox .lw { color: #d29922; }

/* ---------- trang dang nhap: video nen ---------- */
body.loginpage.has-video { background: #000; }
.lg-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #000 url(/static/img/login-bg.jpg) center 35% / cover no-repeat; }
.lg-bg video { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; display: block; }
.lg-shade { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.25) 0%, rgba(0,0,0,.6) 75%); }
.has-video .lg-box { position: relative; z-index: 1; }
.has-video .lg-slogan { color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.8); }
.has-video .lg-form { background: rgba(255,255,255,.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255,255,255,.5); box-shadow: 0 12px 40px rgba(0,0,0,.45); }
html.dark .has-video .lg-form { background: rgba(22,27,34,.84); border-color: rgba(255,255,255,.12); }
.has-video .lg-logo { filter: drop-shadow(0 6px 18px rgba(0,0,0,.55)); }
@media (prefers-reduced-motion: reduce) { .lg-bg video { display: none; } }
/* hai nhan vat nhay hai ben khung dang nhap (chi man hinh rong, khong co tren Safari) */
.lg-dancers { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.lg-dancer { position: absolute; bottom: 0; height: min(72vh, calc((50vw - 240px) * 1.2)); width: auto;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.6)); }
.lg-dancer.left { left: calc((50vw - 210px) / 2); transform: translateX(-50%); }
.lg-dancer.right { right: calc((50vw - 210px) / 2); transform: translateX(50%) scaleX(-1); }
@media (max-width: 900px) { .lg-dancers { display: none; } }
@media (prefers-reduced-motion: reduce) { .lg-dancers { display: none; } }
/* ten nen tang dai (Mini School - Structure Management System): o tim kiem luon con cho, ten bi cat "…" khi chat */
#search-wrap { min-width: 200px; }
header .brand { flex-shrink: 1; min-width: 0; }
header .brand > div { min-width: 0; }
header .brand h1 { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1500px) {
  header { gap: 10px; }
  header #proj { display: none; }
  nav button { padding: 6px 8px; }
  #search-wrap { min-width: 160px; }
  #hstatus { gap: 4px; }
  #hstatus .st { padding: 2px 7px; }
  #meName { max-width: 90px; }
  header .brand { min-width: 230px; }
}

/* ===================================================================== Phase 5d: giao dien dien thoai */
html:not(.mobile) .mobile-only { display: none !important; }
html.mobile body { font-size: 14px; -webkit-tap-highlight-color: transparent; }
html.mobile { --mnav-h: calc(58px + env(safe-area-inset-bottom, 0px)); }

/* dau trang gon: logo · o tim kiem · ☰ */
html.mobile header { height: 52px; padding: 0 8px; gap: 8px; }
html.mobile header .brand { min-width: 0; flex: 0 0 auto; }
html.mobile header .brand > div, html.mobile nav, html.mobile #hstatus, html.mobile #datadate,
html.mobile #btnHelp, html.mobile #btnTheme, html.mobile #btnUser, html.mobile #helpBox { display: none !important; }
html.mobile header .brand img { width: 36px; height: 36px; }
html.mobile #search-wrap { flex: 1 1 auto; min-width: 0; }
html.mobile #q { font-size: 16px; padding: 8px 10px; border-radius: 8px; }
html.mobile #btnMMenu { font-size: 22px; padding: 4px 10px; flex-shrink: 0; }
html.mobile #suggest { position: fixed; left: 6px; right: 6px; top: 50px; max-height: 62vh; }
html.mobile #suggest .it { padding: 10px 12px; }

/* than trang: chua cho thanh tab o day */
html.mobile #app { height: calc(100% - 52px - var(--mnav-h)); }
html.mobile #content { overflow: auto; -webkit-overflow-scrolling: touch; }
html.mobile #sidebar { display: none; }
html.mobile.mfilter #sidebar { display: block !important; position: fixed; left: 0; right: 0; bottom: var(--mnav-h); width: auto;
  max-height: 78vh; z-index: 900; border-radius: 14px 14px 0 0; border: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(0,0,0,.25);
  padding: 0 14px 14px; }
html.mobile.mfilter body::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 899; }
.msheet-head { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 2; background: var(--panel);
  padding: 12px 0 10px; border-bottom: 1px solid var(--line2); margin-bottom: 8px; }
.msheet-head b { font-size: 16px; }
.msheet-head .primary { margin-left: auto; padding: 7px 18px; }
html.mobile #facets label, html.mobile #facets .it { padding: 5px 0; }

/* man hinh Lam viec chia thanh 4 man: Tim · Piece · Ban ve · 3D */
html.mobile #work { display: block; padding: 0; height: 100%; }
html.mobile #work .split, html.mobile #tablebox, html.mobile .pmax, html.mobile #dvPopBtn { display: none !important; }
html.mobile #work-top { display: block; height: 100%; }
html.mobile #work-top > .panel { display: none; border-radius: 0; border-left: 0; border-right: 0; height: 100%; box-sizing: border-box; }
html.mobile[data-mview="search"] #work-top { display: none; }
html.mobile:not([data-mview="search"]) #stageLegend { display: none; }
html.mobile #stageLegend { padding: 8px 10px 2px; }
html.mobile #mlist { display: none; }
html.mobile[data-mview="search"] #mlist { display: block; padding: 6px 10px calc(14px + var(--mnav-h)) 10px; }
html.mobile[data-mview="card"] #card { display: block; padding: 12px 14px 80px; overflow: visible; height: auto; min-height: 100%; }
html.mobile[data-mview="dv"] #dv { display: flex; padding: 6px 8px; }
html.mobile[data-mview="m3"] #m3 { display: flex; padding: 6px 8px; }

/* danh sach dang the */
#mlist .mbar { display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; }
#mlist .mbar button { padding: 7px 12px; }
#mCount { font-weight: 600; }
#mChips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
#mChips:empty { display: none; }
.mchip { background: var(--sel); color: var(--link); border-radius: 14px; padding: 4px 10px; font-size: 13px; }
.mchip a { margin-left: 6px; cursor: pointer; font-weight: 700; }
.mc { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; }
.mc.sel { border-color: var(--link); box-shadow: 0 0 0 1px var(--link) inset; }
.mc:active { background: var(--bg2); }
.mc-h { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.mc-h .wi { color: var(--err); margin-right: 4px; }
.mc-m { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-s { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 6px; font-size: 13px; }
#mMore { text-align: center; padding: 6px 0 10px; }
#mMore button { padding: 9px 16px; width: 100%; }

/* the piece: nut sang ban ve / 3D o tren thanh tab */
html.mobile #mCardBar { display: none; }
html.mobile[data-mview="card"] #mCardBar.on { display: flex; position: fixed; left: 0; right: 0; bottom: var(--mnav-h); z-index: 800;
  gap: 8px; padding: 8px 10px; background: var(--panel); border-top: 1px solid var(--line); }
#mCardBar button { flex: 1; padding: 10px; font-size: 14px; }
html.mobile #card h3 { font-size: 16px; }
html.mobile #card table { width: 100%; }
html.mobile #card td { padding: 5px 4px; }

/* ban ve: nut to cho ngon tay; trinh duyet khong tu phong to trang (de chum 2 ngon phong to ban ve) */
html.mobile #dv .dvbar { gap: 6px; }
html.mobile #dv .dvbar h3 { display: none; }
html.mobile #dv .dvbar button, html.mobile #dv .dvbar select { min-height: 34px; min-width: 34px; padding: 4px 10px; font-size: 14px; }
html.mobile #dvOcc { font-size: 13px; }
html.mobile #dvView { touch-action: pan-x pan-y; }
html.mobile #dvInfo { font-size: 12.5px; }

/* 3D */
html.mobile #m3 .m3bar h3 { display: none; }
html.mobile #m3 .m3bar button, html.mobile #m3 .m3bar select { min-height: 34px; padding: 4px 10px; font-size: 13px; }
.m3start { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 20px; }
.m3start .primary { font-size: 16px; padding: 12px 28px; }

/* thanh tab o day */
html.mobile #mnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--mnav-h); padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 950; background: var(--panel); border-top: 1px solid var(--line); box-sizing: border-box; }
#mnav button { flex: 1; border: none; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; padding: 4px 0; font-size: 10.5px; }
#mnav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#mnav button.on { color: var(--link); font-weight: 600; }

/* menu ☰ */
html.mobile #mMenu { display: none; position: fixed; right: 6px; top: 50px; z-index: 960; width: min(280px, 92vw); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.25); padding: 6px; }
html.mobile #mMenu.on { display: block; }
#mMenu .um-head { padding: 8px 10px; border-bottom: 1px solid var(--line2); }
#mMenu button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 11px 10px; font-size: 14px; }
#mMenu button:active { background: var(--bg2); }
#mmStatus { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line2); }
#mmStatus:empty { display: none; }

/* thong bao nho */
html.mobile #mToast { display: none; position: fixed; left: 10px; right: 10px; bottom: calc(var(--mnav-h) + 10px); z-index: 970;
  background: #24292f; color: #fff; border-radius: 10px; padding: 10px 12px; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
html.mobile #mToast.on { display: flex; }
#mToast span { flex: 1; }
#mToast button { background: #fff; color: #24292f; border: none; border-radius: 6px; padding: 6px 12px; font-weight: 600; }

/* Dashboard */
html.mobile #dash { padding: 8px 10px calc(14px + var(--mnav-h)); }
html.mobile #tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
html.mobile .tile { padding: 10px 11px; }
html.mobile .tile .v { font-size: 22px; }
html.mobile .tile.total .v { font-size: 24px; }
html.mobile #charts { grid-template-columns: minmax(0, 1fr); gap: 10px; }
html.mobile .chart h3 { flex-wrap: wrap; }

/* Theo doi: Assembly dang the; Mini schedule keo ngang */
html.mobile #watch { padding: 8px 10px calc(14px + var(--mnav-h)); height: auto; min-height: 100%; }
html.mobile #wNote { font-size: 12.5px; }
html.mobile #wTable table.wt, html.mobile #wTable table.wt tbody { display: block; width: 100%; }
html.mobile #wTable table.wt tr:first-child { display: none; }
html.mobile #wTable tr.asm { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; margin-top: 8px; }
html.mobile #wTable tr.asm td { border: none; padding: 1px 0; text-align: left; }
html.mobile #wTable tr.asm td:nth-child(1) { grid-column: 1 / -1; font-size: 15px; }
html.mobile #wTable tr.asm td:nth-child(2) { grid-column: 1 / -1; color: var(--muted); }
html.mobile #wTable tr.asm td:nth-child(3) { grid-column: 1 / -1; font-weight: 600; }
html.mobile #wTable tr.asm td:nth-child(4)::before { content: 'Số chi tiết: '; color: var(--muted); }
html.mobile #wTable tr.asm td:nth-child(5)::before { content: 'Xong Fab NDT: '; color: var(--muted); }
html.mobile #wTable tr.asm td:nth-child(6)::before { content: 'Còn thiếu: '; color: var(--muted); }
html.mobile #wTable tr.asm td:nth-child(7)::before { content: 'Tấn: '; color: var(--muted); }
html.mobile #wTable tr.asm td:nth-child(8)::before { content: 'Tấn còn thiếu: '; color: var(--muted); }
html.mobile #wTable tr.asm td:nth-child(6):empty, html.mobile #wTable tr.asm td:nth-child(8):empty { display: none; }
html.mobile #wTable tr.sub { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 12px; margin: 0 8px; border-bottom: 1px solid var(--line2); }
html.mobile #wTable tr.sub td { border: none; padding: 0; }
html.mobile #msTable { overflow: auto; -webkit-overflow-scrolling: touch; max-height: none; }
html.mobile #msView .bar-top { gap: 6px; }
html.mobile .placeholder { flex-direction: column; gap: 8px; }
/* bieu do: giu co chu doc duoc, keo ngang neu man hinh hep */
html.mobile #chDeck, html.mobile #chKind, html.mobile #chWeek, html.mobile #chCum { overflow-x: auto; -webkit-overflow-scrolling: touch; }
html.mobile #chDeck svg, html.mobile #chKind svg, html.mobile #chWeek svg, html.mobile #chCum svg { min-width: 560px; }
html.mobile #mlist .mbar button { white-space: nowrap; }
html.mobile #mCount { font-size: 13px; }

/* ===== Phase 6: nut "Vao Tham Mieu" (cach dieu bang hieu mieu: mai ngoi do, bang go chu vang) ===== */
.mieu-btn { display: inline-flex; flex-direction: column; align-items: center; flex: none; text-decoration: none; position: relative;
  margin-top: 4px; filter: drop-shadow(0 2px 3px rgba(60,20,5,.35)); transition: transform .15s, filter .15s; }
.mieu-btn:hover { transform: translateY(-1px); filter: drop-shadow(0 4px 6px rgba(60,20,5,.45)) brightness(1.08); }
.mieu-btn .mb-roof { display: block; width: calc(100% + 14px); height: 8px; position: relative;
  border-radius: 50% 50% 2px 2px / 120% 120% 2px 2px;
  background: repeating-linear-gradient(90deg, #c03a2b 0 5px, #8f2318 5px 7px);
  box-shadow: inset 0 -2px 0 #6e1a10, inset 0 2px 0 rgba(255,170,130,.35); }
.mieu-btn .mb-roof::before, .mieu-btn .mb-roof::after { content: ''; position: absolute; top: -5px; width: 7px; height: 7px;
  border: 2px solid #e2b54c; border-radius: 50% 50% 50% 0; }
.mieu-btn .mb-roof::before { left: -3px; transform: rotate(-25deg); }
.mieu-btn .mb-roof::after { right: -3px; transform: scaleX(-1) rotate(-25deg); }
.mieu-btn .mb-board { display: block; position: relative; background: linear-gradient(#64301a, #3c190c); color: #f3d27a;
  border: 2px solid #b8862e; box-shadow: inset 0 0 0 1px #7a5520; padding: 4px 11px 5px; white-space: nowrap;
  font: 700 13px/1.1 'Times New Roman', 'Noto Serif', Georgia, serif; letter-spacing: .02em; text-shadow: 0 1px 1px rgba(0,0,0,.7); }
.mieu-btn .mb-board::before { content: ''; position: absolute; left: 50%; top: -13px; width: 7px; height: 7px; margin-left: -4px;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe7a0, #e09a20); box-shadow: 0 0 4px #ffb43a; }
html.mobile #btnMieu { display: none; }
#mMenu .mieu-btn.wide { display: flex; margin: 10px 14px 8px; }
#mMenu .mieu-btn.wide .mb-board { width: 100%; text-align: center; font-size: 16px; padding: 8px 10px; }
@media (max-width: 1500px) { .mieu-btn .mb-board { font-size: 12px; padding: 4px 8px 5px; } }
