:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #1c2530; --muted: #5d6b7a; --line: #dde3ea; --line2: #eef1f5;
  --brand: #1f3a5f; --brand-2: #2c5282; --accent: #e07a1f; --ok: #2f855a; --warn: #b7791f; --bad: #c53030; --info: #2b6cb0;
  --ok-bg: #e6f4ea; --warn-bg: #fdf3e1; --bad-bg: #fde8e8; --info-bg: #e6f0fa; --crit: #d64545;
  --r: 8px; --sh: 0 1px 2px rgba(20,30,45,.06), 0 2px 8px rgba(20,30,45,.05);
  font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 12px; } h2 { font-size: 16px; margin: 18px 0 10px; } h3 { font-size: 14px; margin: 12px 0 8px; }
small, .muted { color: var(--muted); }
code { background: var(--line2); padding: 1px 4px; border-radius: 4px; font-size: 12px; }

/* Bố cục */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #dfe7f1; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { font-weight: 700; color: #fff; font-size: 16px; padding: 4px 8px 12px; display: flex; gap: 8px; align-items: center; }
.side .proj { background: rgba(255,255,255,.08); border-radius: 6px; padding: 8px; margin: 0 0 10px; font-size: 12px; }
.side .proj b { display: block; color: #fff; font-size: 13px; }
.side nav a { display: flex; align-items: center; gap: 8px; color: #dfe7f1; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; }
.side nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.side nav a.on { background: #fff; color: var(--brand); font-weight: 600; }
.side nav .sep { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #f6c177; margin: 14px 6px 4px; padding: 8px 4px 0; border-top: 1px solid rgba(255,255,255,.12); }
.side nav .sep:first-of-type { border-top: 0; }
.side .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .menu { display: none; }
.content { padding: 18px 20px 60px; max-width: 1500px; }
.net { font-size: 12px; padding: 3px 8px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.net.off { background: var(--bad-bg); color: var(--bad); }
.net.pending { background: var(--warn-bg); color: var(--warn); cursor: pointer; }

/* Thành phần */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 14px 16px; margin-bottom: 14px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .grow { flex: 1; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar h1 { margin: 0 auto 0 0; }
.kpi { padding: 12px 14px; }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .s { font-size: 12px; margin-top: 2px; }
.bar { height: 8px; background: var(--line2); border-radius: 4px; overflow: hidden; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand-2); }
.bar > i.p { background: #a0aec0; height: 3px; top: auto; }

button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: #b8c3cf; text-decoration: none; }
button.primary, .btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
button.primary:hover { background: var(--brand); }
button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
button.danger { background: #fff; border-color: #f0b4b4; color: var(--bad); }
button.warn { background: #fff; border-color: #ecc98a; color: var(--warn); }
button.sm, .btn.sm { padding: 3px 8px; font-size: 12.5px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--brand-2); padding: 0; }

input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd3ee; border-color: var(--brand-2); }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
label.f { display: block; font-size: 12.5px; color: var(--muted); }
label.f > span { display: block; margin-bottom: 3px; }
label.f > span b { color: var(--bad); }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 12px; }
.form .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

table.t { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; background: #f8fafc; border-bottom: 1px solid var(--line); padding: 7px 8px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.t td { border-bottom: 1px solid var(--line2); padding: 6px 8px; vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #f7fafd; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.sum td { font-weight: 700; background: #edf2f8; color: #22406a; }
.tw { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; max-height: 70vh; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

.badge { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 10px; background: var(--line2); color: var(--muted); white-space: nowrap; font-weight: 500; }
.b-draft { background: #edf2f7; color: #4a5568; } .b-submitted, .b-fixed, .b-in_progress { background: var(--info-bg); color: var(--info); }
.b-returned, .b-warn, .b-open { background: var(--warn-bg); color: var(--warn); } .b-approved, .b-closed, .b-pass, .b-resolved, .b-ok { background: var(--ok-bg); color: var(--ok); }
.b-rejected, .b-fail, .b-bad, .b-overdue { background: var(--bad-bg); color: var(--bad); }
.b-H { background: var(--bad-bg); color: var(--bad); } .b-W { background: var(--warn-bg); color: var(--warn); } .b-R, .b-S { background: var(--info-bg); color: var(--info); }
.alert { padding: 8px 10px; border-radius: 6px; margin: 6px 0; font-size: 13px; border-left: 3px solid; }
.alert.danger { background: var(--bad-bg); border-color: var(--bad); } .alert.warning { background: var(--warn-bg); border-color: var(--warn); } .alert.info { background: var(--info-bg); border-color: var(--info); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
details.formula { font-size: 12.5px; background: #f8fafc; border: 1px dashed var(--line); border-radius: 6px; padding: 6px 10px; }
details.formula summary { cursor: pointer; color: var(--brand-2); }
details.formula li { margin: 3px 0; }
.planned-calculation { margin:0 0 18px; }
.planned-calculation summary { padding:5px 0; font-weight:600; }
.planned-calculation-body { padding:4px 6px 8px; line-height:1.7; }
.planned-calculation-body ol { padding-left:22px; }
.planned-calculation-body li { margin:7px 0; }
.planned-calculation-body code { white-space:normal; overflow-wrap:anywhere; }
.planned-calculation-results { padding:12px 14px; border:1px solid #d6e3f0; border-radius:8px; background:#fff; }
.planned-calculation-results > div { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; border-top:1px solid var(--line2); padding:7px 0; }
.planned-calculation-results > b { display:block; margin-bottom:6px; }
.planned-calculation-results strong { color:var(--brand-2); font-variant-numeric:tabular-nums; }
dl.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.timeline li { padding: 5px 0 5px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos a { display: block; width: 96px; height: 96px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #f0f3f6; font-size: 11px; color: var(--muted); text-align: center; position: relative; }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos .file { padding: 8px; display: flex; align-items: center; justify-content: center; height: 100%; word-break: break-all; }

/* Hộp thoại & thông báo */
.modal-bg { position: fixed; inset: 0; background: rgba(15,25,40,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: min(760px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal.wide { width: min(1100px, 100%); }
.modal header { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.modal header h3 { margin: 0; flex: 1; font-size: 15px; }
.modal.is-draggable > header { cursor:grab; user-select:none; touch-action:none; border-radius:10px 10px 0 0; background:#f5f8fc; }
.modal.is-draggable > header button { cursor:pointer; }
.modal-drag-grip { color:#7f95ae; font-size:23px; line-height:1; }
.modal-bg.is-dragging,.modal.is-dragging > header { cursor:grabbing; user-select:none; }
.modal.is-resizable { position:relative; flex:none; display:flex; flex-direction:column; max-height:90vh; }
.modal.is-resizable > header,.modal.is-resizable > footer { flex:none; }
.modal.is-resizable > .body { flex:1 1 auto; min-height:0; min-width:0; overflow:auto; }
.modal.is-resizable.is-resized { max-height:calc(100dvh - 24px); }
.modal-bg.is-resizing { user-select:none; }
.modal-resize-handle { position:absolute; z-index:3; touch-action:none; user-select:none; }
.modal-resize-handle.resize-n,.modal-resize-handle.resize-s { height:8px; left:12px; right:12px; cursor:ns-resize; }
.modal-resize-handle.resize-n { top:-4px; } .modal-resize-handle.resize-s { bottom:-4px; }
.modal-resize-handle.resize-e,.modal-resize-handle.resize-w { width:8px; top:12px; bottom:12px; cursor:ew-resize; }
.modal-resize-handle.resize-e { right:-4px; } .modal-resize-handle.resize-w { left:-4px; }
.modal-resize-handle.resize-ne,.modal-resize-handle.resize-se,.modal-resize-handle.resize-sw,.modal-resize-handle.resize-nw { width:16px; height:16px; }
.modal-resize-handle.resize-ne { right:-4px; top:-4px; cursor:nesw-resize; }
.modal-resize-handle.resize-se { right:-4px; bottom:-4px; cursor:nwse-resize; }
.modal-resize-handle.resize-sw { left:-4px; bottom:-4px; cursor:nesw-resize; }
.modal-resize-handle.resize-nw { left:-4px; top:-4px; cursor:nwse-resize; }
.modal-resize-handle.resize-se::after { content:''; position:absolute; right:6px; bottom:6px; width:9px; height:9px; border-right:2px solid #7f95ae; border-bottom:2px solid #7f95ae; border-bottom-right-radius:2px; }
.modal .body { padding: 14px 16px; }
.modal footer { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.toast { background: #1c2530; color: #fff; padding: 9px 12px; border-radius: 6px; font-size: 13px; box-shadow: var(--sh); white-space: pre-line; }
.toast.err { background: var(--bad); } .toast.ok { background: var(--ok); }

/* Gantt */
.gantt-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; max-height: 72vh; }
.gantt-panel { position:relative; min-width:0; }
.gantt-horizontal-bar { position:sticky; bottom:8px; z-index:8; display:flex; align-items:center; gap:12px; min-height:44px; padding:8px 12px; margin-top:6px; border:1px solid #bdccdd; border-radius:7px; background:#f3f7fc; box-shadow:0 2px 8px #173b6026; color:#294c70; }
.gantt-horizontal-bar > span { white-space:nowrap; font-size:12px; font-weight:600; }
.gantt-horizontal-bar button { min-width:32px; padding:4px 8px; }
.gantt-horizontal-bar input[type=range] { flex:1; min-width:70px; width:100%; height:26px; margin:0; padding:0; border:0; background:transparent; accent-color:#315f94; cursor:ew-resize; }
.gantt-horizontal-bar input[type=range]:disabled { cursor:default; opacity:.45; }
.gantt-horizontal-bar input[type=range]:focus-visible { outline:2px solid #719ac7; outline-offset:3px; border-radius:6px; }
.gantt-wrap { scrollbar-width:auto; scrollbar-color:#8fa9c7 #e9eef5; }
.gantt-wrap::-webkit-scrollbar { width:16px; height:16px; }
.gantt-wrap::-webkit-scrollbar-track { background:#e9eef5; }
.gantt-wrap::-webkit-scrollbar-thumb { background:#8fa9c7; border:3px solid #e9eef5; border-radius:10px; }
@media(max-width:600px) { .gantt-horizontal-bar { gap:7px; padding:7px 8px; bottom:5px; } .gantt-horizontal-bar > span { font-size:11px; } }
table.gantt { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.gantt th, table.gantt td { border-bottom: 1px solid var(--line2); padding: 0 6px; height: 30px; white-space: nowrap; background: #fff; }
table.gantt thead th { position: sticky; top: 0; z-index: 3; background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 11.5px; height: 34px; border-bottom: 1px solid var(--line); }
table.gantt .stk { position: sticky; z-index: 2; }
table.gantt thead .stk { z-index: 4; }
table.gantt td.nm { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
table.gantt tr.sumrow td { font-weight: 600; background: #f4f7fb; }
table.gantt tr.sumrow.lv0 td { background: #dfe8f3; color: var(--brand); font-weight: 700; font-size: 13px; border-top: 2px solid #9fb6d3; }
table.gantt tr.sumrow.lv1 td { background: #edf2f8; color: #22406a; font-weight: 700; }
table.gantt tr.sumrow.lv0 td.chart, table.gantt tr.sumrow.lv1 td.chart { background: #fff; }
table.gantt tr.sumrow.lv0 .gbar.sum { background: var(--brand); height: 8px; top: 11px; }
table.gantt tr.click:hover td { background: #f3f7fc; }
.form [hidden], table.t input[hidden] { display: none !important; }
table.gantt td.chart { padding: 0; position: relative; }
.gcell { position: relative; height: 30px; }
.gbar { position: absolute; top: 8px; height: 14px; border-radius: 3px; background: #7fa3cf; overflow: hidden; }
.gbar.crit { background: #e89a9a; } .gbar.sum { background: #4a5568; height: 6px; top: 12px; border-radius: 1px; }
.gbar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand); }
.gbar.crit > i { background: var(--crit); }
.gbase { position: absolute; top: 23px; height: 4px; background: #b8c2cc; border-radius: 2px; }
.gms { position: absolute; top: 8px; width: 13px; height: 13px; transform: rotate(45deg); background: var(--brand); margin-left: -6px; }
.gms.crit { background: var(--crit); } .gms.done { background: var(--ok); }
.gtoday { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--accent); z-index: 1; pointer-events: none; }
.gscale { position: relative; height: 34px; }
.gscale span { position: absolute; top: 2px; font-size: 10.5px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 3px; height: 30px; line-height: 14px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 6px 0; }
.legend i { display: inline-block; width: 18px; height: 8px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }

/* Đăng nhập */
.login { max-width: 380px; margin: 12vh auto; }
.login .card { padding: 24px; }
.brand-mark { width:40px; height:40px; object-fit:contain; background:white; border-radius:8px; flex:none; }
.login-brand { display:block; width:112px; height:112px; object-fit:contain; margin:0 auto 18px; border-radius:14px; }
.login h1,.login .card > .muted { text-align:center; }

/* Di động */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .top .menu { display: inline-flex; }
  .content { padding: 12px 12px 70px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; }
  dl.kv { grid-template-columns: 120px 1fr; }
  .hide-m { display: none !important; }
  input, select, textarea { font-size: 16px; } /* tránh iOS phóng to */
}
@media (max-width: 520px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: 1fr 1fr; } .toolbar h1 { width: 100%; } }

/* In ấn */
@media print {
  .side, .top, .no-print, .toasts { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; }
  body { background: #fff; } .card { box-shadow: none; border: 0; padding: 0; }
}
.print-page { background: #fff; max-width: 820px; margin: 0 auto; padding: 24px 28px; font-family: "Times New Roman", Times, serif; font-size: 14px; color: #000; }
.print-page .ph { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: center; font-size: 13px; white-space: pre-line; }
.print-page h1 { text-align: center; font-size: 17px; margin: 18px 0 6px; }
.print-page table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.print-page td, .print-page th { border: 1px solid #000; padding: 4px 6px; font-size: 13px; vertical-align: top; }
.print-page .sig { display: grid; gap: 10px; margin-top: 26px; text-align: center; font-weight: bold; }
.print-page .sig div { min-height: 110px; }
.print-page .foot { margin-top: 20px; font-size: 11px; font-style: italic; color: #444; border-top: 1px solid #999; padding-top: 6px; }
.print-page .basis { font-size: 12.5px; font-style: italic; white-space: pre-line; }
table.t tr.on td { background: #fff7ed; }
/* v16 */
.kpi .v.bad { color: var(--bad); }
.bell { position: relative; }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 5px; line-height: 16px; }
.notif a { display: block; padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notif a.unread { background: var(--info-bg); font-weight: 600; }
.notif a:hover { text-decoration: none; background: #f5f7fa; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: clamp(17px, 1.7vw, 24px); overflow-wrap: anywhere; }
button.gantt-progress { color:inherit; font:inherit; padding:2px 0; border:0; border-bottom:1px dotted currentColor; background:transparent; border-radius:0; }
button.gantt-progress:hover,button.gantt-progress:focus-visible { background:var(--info-bg); outline:2px solid #b7cfe8; outline-offset:2px; }
.progress-entry-preview { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:16px 18px; background:#eef7f2; border:1px solid #d0e7d8; border-radius:10px; margin-top:18px; color:#167447; }
.progress-entry-preview strong { font-size:26px; font-variant-numeric:tabular-nums; max-width:65%; text-align:right; overflow-wrap:anywhere; }
.daily-quantity-toolbar { display:flex; gap:10px; align-items:end; flex-wrap:wrap; padding:10px 0 12px; border-bottom:1px solid var(--line); position:sticky; top:52px; z-index:2; background:var(--panel); }
.modal .daily-quantity-toolbar { top:0; }
.daily-quantity-toolbar label,.daily-quantity-meta label,.daily-quantity-selectors label { display:flex; flex-direction:column; gap:6px; font-size:12px; color:var(--muted); }
.daily-quantity-toolbar input { width:150px; }
.daily-quantity-meta,.daily-quantity-selectors { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; padding:14px 16px; border:1px solid var(--line); border-radius:10px; background:#fff; margin:12px 0; }
.daily-quantity-meta input,.daily-quantity-meta select,.daily-quantity-selectors select { width:100%; min-width:0; }
.daily-quantity-meta strong { display:block; margin-top:8px; font-size:22px; color:var(--brand); }
.daily-quantity-selectors { grid-template-columns:minmax(0,1fr) minmax(0,2fr); }
.daily-quantity-table { min-width:1000px; }
.daily-quantity-table th { white-space:nowrap; }
.daily-quantity-table input[type=number] { width:112px; text-align:right; }
.daily-quantity-table input:not([type=number]) { min-width:150px; width:100%; }
.daily-quantity-table td.n { font-variant-numeric:tabular-nums; }
@media(max-width:600px) { .daily-quantity-meta,.daily-quantity-selectors { grid-template-columns:minmax(0,1fr); } .daily-quantity-toolbar input { width:140px; } }
.mail-panel { max-width:1240px; border-top:3px solid #2e5d8e; }
.s-curve-chart { min-width:0; }
.dashboard-curve { min-width:0; }
.dashboard-curve h2 { margin-bottom:4px; }
.dashboard-curve > .hint { margin:5px 0 12px; }
@media(max-width:1400px) { .grid.dashboard-curves { grid-template-columns:minmax(0,1fr); } }
.s-curve-plot { overflow-x:auto; padding-bottom:2px; }
.s-curve-plot > svg { display:block; min-width:480px; }
.grid.dashboard-progress { grid-template-columns:minmax(0,2fr) minmax(260px,1fr); }
@media(max-width:1100px) { .grid.dashboard-progress { grid-template-columns:minmax(0,1fr); } }
.s-curve-legend { display:flex; flex-wrap:wrap; gap:10px 20px; margin:10px 0 4px; font-size:12px; }
.s-curve-legend span { display:inline-flex; gap:6px; align-items:center; }
.s-curve-legend svg { width:34px; height:12px; flex-shrink:0; }
.s-curve-legend b { font-variant-numeric:tabular-nums; }
.mail-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; }
.mail-heading h2 { margin:0 0 6px; font-size:20px; }
.mail-heading p { margin:0; max-width:760px; }
.mail-panel .form { gap:16px 24px; grid-template-columns:repeat(2,minmax(0,1fr)); }
.mail-panel .form [hidden] { display:none !important; }
.mail-status { display:inline-block; padding:5px 11px; border-radius:20px; font-size:12px; white-space:nowrap; }
.mail-status.ok { color:#147342; background:#e6f4eb; }
.mail-status.bad { color:#a32b2b; background:#fdeeee; }
.mail-status.neutral { color:#4e6177; background:#edf1f6; }
.mail-types { display:flex; flex-wrap:wrap; gap:10px 24px; margin:12px 0; }
.mail-types label { display:flex; gap:8px; align-items:center; background:#f4f7fb; border:1px solid #dfe7f0; padding:10px 14px; border-radius:8px; }
.mail-actions { display:flex; flex-wrap:wrap; gap:10px; margin:20px 0 12px; }
.mail-test { display:flex; flex-wrap:wrap; gap:10px; padding:16px; border:1px dashed #c9d7e5; border-radius:9px; background:#f8fafd; }
.mail-test input { max-width:360px; flex:1 1 240px; }
.mail-history { border-top:1px solid #e0e7ef; margin-top:24px; padding-top:16px; }
.mail-history summary { font-weight:600; cursor:pointer; margin-bottom:14px; }
.mail-kind { font-size:11px; color:#53708c; }
.mail-check { text-align:center; }
.mail-members { min-width:920px; }
.mail-members th { text-align:center; }
.mail-members th:nth-child(-n+2) { text-align:left; }
.mail-members th button { margin-top:6px; font-size:10px; }
.mail-members td { vertical-align:middle; }
.mail-preview { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; line-height:1.7; background:#f6f8fb; padding:18px; border-radius:8px; }
.mail-report { margin:12px 0; border:1px solid #dce5ef; border-radius:8px; padding:12px; }
.mail-report summary { cursor:pointer; }
@media(max-width:600px) { .mail-heading { flex-direction:column; } .mail-panel .form { grid-template-columns:minmax(0,1fr); } .mail-actions button,.mail-test button { width:100%; } }
.qltc-quick-launcher { position:fixed; right:22px; bottom:22px; z-index:30; font-family:"Segoe UI",Arial,sans-serif; }
.qltc-quick-button { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:2px; width:66px; height:66px; padding:0; border-radius:50%; border:3px solid #fff; color:#fff; background:linear-gradient(145deg,#3979b7,#173c68); box-shadow:0 4px 16px #18365240,0 0 0 1px #acc6df; }
.qltc-quick-button:hover,.qltc-quick-button[aria-expanded=true] { background:linear-gradient(145deg,#2d6aab,#102c50); color:#fff; }
.qltc-quick-button span { font-size:16px; font-weight:750; letter-spacing:.5px; }
.qltc-quick-button small { font-size:8px; letter-spacing:1.5px; opacity:.85; }
.qltc-quick-panel { position:absolute; right:0; bottom:80px; width:350px; max-width:calc(100vw - 28px); max-height:calc(100dvh - 130px); overflow:auto; background:#fff; color:#183450; border:1px solid #d5e0eb; border-radius:14px; box-shadow:0 12px 40px #152f4d30; }
.qltc-quick-panel[hidden] { display:none!important; }
.qltc-quick-header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:16px; background:#f2f6fb; border-bottom:1px solid #dfe8f1; }
.qltc-quick-header b { font-size:14px; }
.qltc-quick-header small { display:block; max-width:255px; margin-top:5px; font-size:11px; color:#62778b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.qltc-quick-close { border:0; background:transparent; color:#62778b; font-size:23px; padding:0 4px; }
.qltc-quick-item { display:flex; align-items:center; gap:12px; padding:12px 16px; color:inherit; text-decoration:none; border-bottom:1px solid #f0f3f7; }
.qltc-quick-item:hover,.qltc-quick-item:focus-visible { background:#edf5ff; text-decoration:none; }
.qltc-quick-icon { width:36px; height:36px; flex-shrink:0; display:flex; align-items:center; justify-content:center; border-radius:8px; color:#fff; font-size:12px; font-weight:700; }
.qltc-quick-icon.blue { background:#2976be; }.qltc-quick-icon.green { background:#33885f; }.qltc-quick-icon.orange { background:#bc722e; }.qltc-quick-icon.violet { background:#7262a5; }.qltc-quick-icon.teal { background:#287f8b; }.qltc-quick-icon.slate { background:#526e87; }
.qltc-quick-text { flex:1; min-width:0; }.qltc-quick-text b { display:block; font-size:12px; color:#1e507d; }.qltc-quick-text small { display:block; font-size:10px; color:#657e94; line-height:1.5; margin-top:3px; }
.qltc-quick-arrow { color:#8b9cae; font-size:21px; }
.qltc-quick-more { padding:12px 16px; background:#fbfcfe; }.qltc-quick-more summary { cursor:pointer; font-size:12px; font-weight:600; color:#526e87; }.qltc-quick-more nav { display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:12px 0 2px; }.qltc-quick-more a { font-size:11px; }
@media(max-width:650px) { .qltc-quick-launcher { right:14px; bottom:14px; }.qltc-quick-button { width:56px; height:56px; }.qltc-quick-panel { bottom:68px; max-height:calc(100dvh - 105px); } }
@media print { .qltc-quick-launcher { display:none!important; } }

/* Cửa sổ Windows có thanh chức năng riêng; trình duyệt web vẫn giữ menu bên trái. */
html.windows-app .app { grid-template-columns: minmax(0,1fr); }
html.windows-app .side, html.windows-app .top .menu { display:none; }
html.windows-app .content { max-width:none; padding:16px 22px 45px; }
html.windows-app .qltc-quick-launcher { display:block; }

/* Daily production averages use the same working-day period for KH and TT. */
.production-averages { margin:16px 0; border:1px solid var(--line); border-radius:12px; background:#fff; padding:16px 18px; break-inside:avoid; }
.production-average-heading h3 { margin:0 0 5px; font-size:15px; }
.production-average-heading p { margin:0 0 14px; font-size:11px; line-height:1.6; }
.production-average-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.production-average { min-width:0; padding:14px 16px; border-radius:10px; border:1px solid #d7e5f4; background:#f2f7fd; color:#2563a6; }
.production-average.actual { color:#168053; background:#f0f9f4; border-color:#d3eade; }
.production-average .l { font-size:10px; font-weight:700; letter-spacing:.5px; }
.production-average strong { display:block; margin:8px 0 6px; font-size:clamp(20px,2.5vw,28px); font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.production-average small { display:block; font-size:11px; line-height:1.6; }
.production-averages > .hint { margin:12px 0 0; }
@media(max-width:600px) { .production-average-grid { grid-template-columns:minmax(0,1fr); } }
@media print { .production-averages { padding:8px 10px; margin:8px 0; } .production-average { padding:6px 10px; } .production-average strong { font-size:16px; } .production-averages .hint { font-size:9px; } }

/* Logo do chu so huu cung cap */
.qltc-quick-button{background:#fff;border-color:#c69b50;padding:5px;overflow:hidden}.qltc-quick-button img{display:block;width:100%;height:100%;object-fit:contain;border-radius:50%}
.qltc-assistant-greeting{position:absolute;right:77px;bottom:18px;width:max-content;max-width:calc(100vw - 110px);background:#087cff;color:#fff;border:0;border-radius:7px;padding:8px 12px;font-size:12px;box-shadow:0 3px 10px #1235;white-space:normal;text-align:left}
.qltc-assistant-greeting[hidden]{display:none!important}
.qltc-assistant-greeting:after{content:"";position:absolute;right:-6px;bottom:12px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-left:7px solid #087cff}
.qltc-quick-button .qltc-assistant-face{font-size:30px;line-height:1}
.qltc-quick-button small{font-size:8px;color:#173c68;font-weight:700;letter-spacing:1px}
.qltc-assistant-intro{margin:0;padding:12px 16px;font-size:12px;line-height:1.6;color:#526e87;background:#f8fbff}

/* v18.25 – Thanh biểu tượng trên cùng, bảng bật lên, lịch sử cập nhật */
.ticons { display: flex; align-items: center; gap: 2px; }
button.ticon { width: 34px; height: 34px; padding: 0; justify-content: center; border: 0; background: transparent; color: #4a5a6c; border-radius: 8px; position: relative; }
button.ticon:hover { background: #eef2f7; color: var(--brand); }
button.ticon.gear { background: #fdf0e3; color: var(--accent); }
button.ticon.gear:hover { background: #fbe2c8; }
button.ticon.bell .count { top: 1px; right: 0; }
.top-pop { position: fixed; z-index: 60; width: min(360px, calc(100vw - 16px)); max-height: min(70vh, 560px); overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 34px rgba(16,24,40,.18); padding: 10px; }
.top-pop h4 { margin: 2px 4px 8px; font-size: 14px; }
.top-pop .row { align-items: baseline; padding: 0 4px; }
.pop-list > div { display: flex; gap: 10px; padding: 8px 4px; border-top: 1px solid var(--line2); font-size: 13px; }
.pop-list small { display: block; }
.av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #e3ebf6; color: var(--brand-2); font-size: 10.5px; font-weight: 700; }
html[data-theme="dark"] .av { background: #243a57; color: #cfe0f5; }
button.pop-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 7px; padding: 8px 10px; white-space: normal; }
button.pop-item:hover { background: #f3f6fa; }
button.pop-item small { display: block; font-size: 11.5px; }
.pop-user { padding: 6px 10px 10px; border-bottom: 1px solid var(--line2); margin-bottom: 4px; }
.pop-user small { display: block; }
.hist-day h3 { margin: 0 0 6px; }
.hist-row { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line2); font-size: 13px; }
.hist-row small { display: block; }
.hist-row details summary { cursor: pointer; font-size: 12px; color: var(--brand-2); }
.hist-diff { font-size: 12px; margin-top: 4px; display: grid; gap: 2px; }
.hist-diff .k { display: inline-block; min-width: 130px; color: var(--muted); }
.hist-diff s { color: var(--bad); }
@media (max-width: 720px) { .ticons button.ticon { width: 30px; } }
