/* Giao dien uu tien dien thoai, chu du lon, nut bam ro rang. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #16202a;
  --ink-soft: #5b6b7a;
  --line: #dfe5ea;
  --brand: #0f766e;
  --brand-dark: #0b5c56;
  --brand-soft: #e6f4f2;
  --danger: #b02318;
  --danger-soft: #fdecea;
  --warn: #8a4a00;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #e8f5ec;
  --purple: #6b21a8;
  --purple-soft: #f3e8ff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,32,42,.08), 0 4px 12px rgba(16,32,42,.05);
  --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }
a.btn, a.chip, a.stat, .sidenav a, .tabs a, .usermenu-panel a { text-decoration: none; }
/* Chi danh cho may doc man hinh, khong hien tren giao dien */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .98rem; margin: 0 0 .5rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }
.ta-right { text-align: right; }
.ta-center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Thanh tren ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .5rem;
  background: var(--brand); color: #fff; padding: .5rem .7rem;
  padding-top: calc(.5rem + env(safe-area-inset-top));
  box-shadow: var(--shadow);
}
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap; font-size: 1.05rem; }
.topbar .brand span { font-weight: 400; opacity: .85; display: none; }
.icon-btn {
  background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 10px;
  min-width: var(--tap); height: var(--tap); font-size: 1.1rem; cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn .dot {
  position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff;
  border-radius: 999px; font-size: .62rem; padding: 0 4px; min-width: 16px; line-height: 16px;
}
.topsearch { flex: 1; display: flex; min-width: 0; }
.topsearch input {
  flex: 1; min-width: 0; border: 0; border-radius: 10px 0 0 10px; padding: .6rem .7rem; font-size: 1rem;
}
.topsearch button { border: 0; background: #fff; border-radius: 0 10px 10px 0; padding: 0 .7rem; cursor: pointer; }
.usermenu { position: relative; }
.usermenu summary {
  list-style: none; cursor: pointer; background: rgba(255,255,255,.14); border-radius: 10px;
  height: var(--tap); display: flex; align-items: center; padding: 0 .7rem; white-space: nowrap;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: .7rem; min-width: 200px; display: grid; gap: .5rem;
}
.usermenu-panel a, .linklike {
  color: var(--brand-dark); background: none; border: 0; padding: .4rem 0; text-align: left;
  font: inherit; cursor: pointer; text-decoration: none;
}

/* ---------- Dieu huong ---------- */
/* Dien thoai: thanh duoi toi da 3 muc + nut Them. May tinh: thanh ben day du. */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; padding: .35rem .25rem; color: var(--ink-soft); text-decoration: none;
  /* Cua hang sang, nhan vien liec nhanh — duoi 12px la kho doc. */
  font-size: .8rem; font-weight: 600; text-align: center;
}
.tabbar a span { font-size: 1.25rem; line-height: 1; }
.tabbar a.active { color: var(--brand-dark); }
.tabbar a.active span { transform: scale(1.05); }
.sidenav { display: none; }

main { padding: .8rem; max-width: 1100px; margin: 0 auto; }
main.with-nav { padding-bottom: 5.5rem; }
main.wide { max-width: 1400px; }

/* ---------- The & bang ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem; margin-bottom: .8rem; box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.page-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.grid { display: grid; gap: .8rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: repeat(2, 1fr); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-bottom: .8rem; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem;
  text-decoration: none; color: inherit; display: grid; gap: 2px;
}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: .78rem; color: var(--ink-soft); }
.stat-red .stat-value { color: var(--danger); }
.stat-amber .stat-value { color: var(--warn); }
.stat-green .stat-value { color: var(--ok); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .55rem .5rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; color: var(--ink-soft); white-space: nowrap; }
td.empty { text-align: center; color: var(--ink-soft); padding: 1.5rem; }
tbody tr:hover { background: #fafcfd; }

/* ---------- Nhan trang thai ---------- */
.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .76rem;
  font-weight: 600; background: #eceff1; color: #37474f; white-space: nowrap;
}
.badge-slate { background: #e8edf1; color: #38505f; }
.badge-blue { background: #e3f0fd; color: #14538a; }
.badge-amber { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.badge-green { background: var(--ok-soft); color: var(--ok); }
.badge-red { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-gray { background: #eceff1; color: #546e7a; }
.badge-done { background: #dcfce7; color: #14532d; }

/* ---------- Bieu mau ---------- */
.field { margin-bottom: .75rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
.req { color: var(--danger); }
input, select, textarea {
  width: 100%; padding: .65rem .7rem; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink); min-height: var(--tap);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(15,118,110,.35); border-color: var(--brand); }
/* O chon Dat / Khong dat trong checklist test: vung cham lon, de bam bang ngon tay */
input[type="radio"], input[type="checkbox"] {
  width: 22px; min-width: 22px; height: 22px; min-height: 22px; margin: 0;
  accent-color: var(--brand); cursor: pointer;
}
.radio-cell {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; cursor: pointer; border-radius: 8px;
}
.radio-cell:hover { background: var(--brand-soft); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.topbar :focus-visible, .usermenu summary:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
textarea { min-height: 80px; resize: vertical; }
.hint { color: var(--ink-soft); font-size: .78rem; display: block; margin-top: .2rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .shrink { flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  /* Nhan vien bam bang ngon cai trong khi tay kia cam may khach — phai du 44px. */
  display: inline-flex; align-items: center; gap: .35rem; min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 999px; padding: .35rem .85rem; background: #fff; cursor: pointer; font-size: .88rem;
}
.chip input { width: auto; min-height: auto; margin: 0; }
.chip:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: .65rem 1rem;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: var(--tap);
}
.btn:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--brand-dark); border: 1px solid var(--line); }
.btn-danger { background: var(--danger); }
.btn-warn { background: var(--warn); }
.btn-sm { padding: .45rem .8rem; min-height: 40px; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.flash { padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: .8rem; font-weight: 500; }
.flash-info { background: var(--brand-soft); color: var(--brand-dark); }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.flash-warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* ---------- Chi tiet phieu ---------- */
.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: .8rem; }
.tabs a {
  padding: .55rem .8rem; text-decoration: none; color: var(--ink-soft); white-space: nowrap;
  border-bottom: 3px solid transparent; font-size: .92rem;
}
.tabs a.active { color: var(--brand-dark); border-color: var(--brand); font-weight: 700; }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .35rem .7rem; font-size: .93rem; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid var(--line); }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: .35rem; width: 12px; height: 12px;
  border-radius: 50%; background: var(--brand); border: 2px solid #fff;
}
.timeline li:last-child { border-left-color: transparent; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.secret-box {
  background: var(--warn-soft); border: 1px dashed var(--warn); border-radius: 10px; padding: .6rem;
  font-family: ui-monospace, monospace;
}

/* ---------- Checklist test ---------- */
.checklist { list-style: none; margin: 0; padding: 0; counter-reset: cl; }
.checklist-item { margin-bottom: .5rem; }
.checklist fieldset {
  border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .7rem; margin: 0;
}
.checklist legend { font-weight: 600; font-size: .95rem; padding: 0 .3rem; }
.checklist .opts { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .5rem; }
.checklist .opt {
  flex: 1 1 30%; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: var(--tap); border: 1px solid var(--line); border-radius: 10px; padding: .4rem .5rem;
  cursor: pointer; background: #fff; font-size: .9rem; font-weight: 600; text-align: center;
}
.checklist .opt input { width: 20px; min-width: 20px; height: 20px; min-height: 20px; }
.checklist .opt-pass.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.checklist .opt-fail.on { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.checklist .opt-na.on { background: #eceff1; border-color: #90a4ae; color: #37474f; }
.checklist .opt:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- Modal quet ma ---------- */
.modal { position: fixed; inset: 0; background: rgba(10,20,25,.65); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 1rem; width: min(460px, 100%); display: grid; gap: .6rem; }
#scanVideo { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 4/3; object-fit: cover; }

/* ---------- Bieu do don gian ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars .bar { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .bar span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: .6rem; color: var(--ink-soft); }

/* ---------- In an ---------- */

/* Tem dan may: giay in nhiet 35 x 22 mm.
   Khong du cho cho ma vach 1D (mot module se nho hon 0,19mm, may quet doc khong noi),
   nen tem chi mang ma QR. Ma vach van in duoc tren phieu A5. */
.label-sheet {
  width: 35mm; height: 22mm; padding: 1mm 1.2mm; overflow: hidden;
  font-family: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  display: grid; grid-template-columns: 14mm 1fr; gap: 1mm; align-items: center;
  color: #000; background: #fff; line-height: 1.15;
}
.label-sheet .qr { width: 14mm; height: 14mm; }
.label-sheet .qr svg { width: 100%; height: 100%; display: block; }
.label-sheet .side { min-width: 0; }
.label-sheet .code { font-size: 8pt; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.label-sheet .model { font-size: 6pt; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-sheet .meta { font-size: 5pt; color: #333; white-space: nowrap; }

/* Phieu nhan may, phieu bao hanh, hoa don: giay A5 */
.receipt {
  width: 100%; max-width: 124mm; margin: 0 auto;
  font-size: 10.5pt; line-height: 1.45; color: #000;
}
.receipt h2 { font-size: 15pt; }
.receipt h3 { font-size: 12pt; letter-spacing: .04em; }
.receipt table { font-size: 9.5pt; }
.receipt .kv { grid-template-columns: 34mm 1fr; gap: .2rem .5rem; }
.receipt hr { border: 0; border-top: 1px solid #000; margin: 2mm 0; }
.receipt .sign { display: flex; justify-content: space-between; margin-top: 12mm; font-size: 9.5pt; }
.receipt .sign div { text-align: center; width: 45%; }

@media print {
  .no-print, .topbar, .sidenav, .tabs, .flash { display: none !important; }
  body { background: #fff; color: #000; }
  main, main.with-nav { padding: 0; margin: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; margin: 0; background: #fff; }
  a { text-decoration: none; color: #000; }
  /* Tem: khong duoc de trang thu hai chay ra */
  body.printable-tem { margin: 0; }
  body.printable-tem .label-sheet { page-break-after: avoid; }
}

/* ---------- Man hinh lon ---------- */
@media (min-width: 720px) {
  .topbar .brand span { display: inline; }
  .topbar .brand strong { font-weight: 700; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1000px) {
  .tabbar { display: none; }
  .sidenav {
    display: flex; position: fixed; inset: 0 auto 0 0; top: 60px; width: 200px; flex-direction: column;
    background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: .6rem; gap: 2px;
  }
  .sidenav a {
    display: flex; align-items: center; gap: .55rem; padding: .55rem .7rem; border-radius: 10px;
    color: var(--ink-soft); text-decoration: none; font-size: .92rem; font-weight: 600;
  }
  .sidenav a span { font-size: 1rem; }
  .sidenav a.active { background: var(--brand-soft); color: var(--brand-dark); }
  main.with-nav { margin-left: 200px; padding-bottom: 1rem; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  /* Bang doi sang dang the de doc tren dien thoai */
  table.stack thead { display: none; }
  table.stack tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .5rem; padding: .4rem; }
  table.stack td { display: flex; justify-content: space-between; gap: .6rem; border: 0; padding: .3rem .2rem; }
  table.stack td::before { content: attr(data-label); color: var(--ink-soft); font-size: .78rem; font-weight: 600; max-width: 45%; word-break: break-word; }
  table.stack th[scope="row"] { display: block; border: 0; padding: .3rem .2rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Trang chu theo vai tro ---------- */
.btn-big {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 58px; font-size: 1.08rem; font-weight: 700;
  border-radius: 14px; margin-bottom: .9rem;
}
.grouphead {
  display: flex; align-items: center; gap: .5rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); margin: 1.1rem 0 .5rem;
}
.grouphead b { color: var(--ink); font-variant-numeric: tabular-nums; }
.grouphead::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.taskrow {
  display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 12px; padding: .65rem .75rem; margin-bottom: .45rem; min-height: 56px;
}
.taskrow:hover { border-color: var(--brand); }
.taskrow .tx { flex: 1; min-width: 0; display: block; }
.taskrow .t1 { display: block; font-weight: 600; font-size: .96rem; line-height: 1.3; }
.taskrow .t2 { display: block; font-size: .8rem; color: var(--ink-soft); margin-top: 1px; }
.taskrow .go {
  flex: 0 0 auto; background: var(--brand); color: #fff; border-radius: 9px;
  padding: .5rem .75rem; font-size: .85rem; font-weight: 700; min-height: 40px;
  display: flex; align-items: center;
}
.taskrow .go.ghost { background: transparent; color: var(--brand-dark); border: 1px solid var(--line); }
.taskrow.tone-amber { border-left-color: var(--warn); }
.taskrow.tone-red { border-left-color: var(--danger); }
.taskrow.tone-green { border-left-color: var(--ok); }

.rushrow {
  display: block; text-decoration: none; color: inherit; margin-bottom: .55rem;
  border: 2px solid var(--danger); border-radius: 13px; overflow: hidden; background: var(--surface);
}
.rushrow .tp {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  background: var(--danger); color: #fff; padding: .3rem .7rem;
}
.rushrow .tp .bl { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.rushrow .tp .cd { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; font-weight: 700; }
.rushrow .bd { display: block; padding: .55rem .75rem; }
.rushrow .bd .t1 { display: block; font-weight: 700; font-size: .98rem; }
.rushrow .bd .t2 { display: block; font-size: .8rem; color: var(--ink-soft); margin-top: 1px; }
.rushrow .bt {
  display: block; margin: 0 .55rem .55rem; background: var(--danger); color: #fff;
  border-radius: 10px; padding: .6rem; text-align: center; font-weight: 700; font-size: .92rem;
}

.donecard {
  border: 1px solid var(--ok); border-radius: 13px; overflow: hidden;
  background: var(--surface); margin-bottom: .6rem;
}
.donecard .hd { display: block; padding: .55rem .75rem; background: var(--ok-soft); text-decoration: none; }
.donecard .hd .t1 { display: block; font-weight: 700; font-size: .96rem; color: var(--ok); }
.donecard .hd .t2 { display: block; font-size: .78rem; color: var(--ink-soft); margin-top: 1px; }
.donecard .gr { margin: 0; }
.donecard .gr div {
  display: flex; justify-content: space-between; gap: .6rem;
  padding: .4rem .75rem; border-top: 1px solid var(--line); font-size: .88rem;
}
.donecard .gr dt { color: var(--ink-soft); margin: 0; flex: 0 0 auto; }
.donecard .gr dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
.donecard .bt {
  display: block; margin: .6rem; background: var(--brand); color: #fff; border-radius: 10px;
  padding: .7rem; text-align: center; font-weight: 700; text-decoration: none; min-height: 44px;
}
.emptynote { color: var(--ink-soft); font-size: .9rem; padding: .5rem .2rem; margin: 0; }

/* Danh sach man hinh trong trang "Thêm" */
.morelist { display: grid; gap: .5rem; }
.morelist a {
  display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: .8rem .9rem; min-height: 56px; font-weight: 600;
}
.morelist a:hover { border-color: var(--brand); }
.morelist a span.ic { font-size: 1.2rem; width: 1.6rem; text-align: center; }
.morelist a span.ar { margin-left: auto; color: var(--ink-soft); }

/* ---------- Bieu mau nhan may ba buoc ---------- */
.wizard .wstep[hidden] { display: none; }
.wprog { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.wprog .bar { flex: 1; height: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.wprog .bar i { display: block; height: 100%; background: var(--brand); transition: width .2s ease; }
.wprog .tx { font-size: .78rem; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.wtitle { font-size: 1.25rem; margin: 0 0 .9rem; }
.wizard .field { margin-bottom: .9rem; }
.wmore { margin: .3rem 0 1rem; }
.wmore > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center;
  padding: .6rem .9rem; border: 1px dashed var(--line); border-radius: 10px;
  font-weight: 600; font-size: .9rem; color: var(--ink-soft); min-height: 44px;
}
.wmore > summary::-webkit-details-marker { display: none; }
.wmore[open] > summary { margin-bottom: .8rem; border-style: solid; }
.wsum { background: var(--surface-2, var(--surface)); margin: 1rem 0; }
.wsum .kv { grid-template-columns: minmax(90px, 34%) 1fr; font-size: .9rem; }

/* Chip dang nut (chon nhanh may) */
button.chip { font: inherit; cursor: pointer; }
button.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 700; }

/* Luoi ve hinh mo khoa */
.patgrid {
  display: grid; grid-template-columns: repeat(3, 56px); gap: 14px;
  justify-content: center; padding: 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
}
.patdot {
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--rule-2, #b9c4bd);
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 700; color: transparent; padding: 0;
}
.patdot span { font-size: .95rem; }
.patdot.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.patline { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .5rem; }

/* ---------- Khoi "Việc tiếp theo" ---------- */
.nextbox {
  background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 14px;
  padding: .85rem .95rem; margin-bottom: .9rem;
}
.nextbox .lb {
  display: block; font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand-dark);
}
.nextbox .tt { margin: .2rem 0 0; font-size: 1.12rem; font-weight: 700; line-height: 1.25; }
.nextbox .ht { margin: .15rem 0 .7rem; font-size: .85rem; color: var(--ink-soft); }
.nextbox form { margin: 0; }
.nextbox .bt {
  display: flex; align-items: center; justify-content: center; width: 100%;
  background: var(--brand); color: #fff; border: 0; border-radius: 11px;
  padding: .85rem; font: inherit; font-size: 1.02rem; font-weight: 700;
  text-decoration: none; cursor: pointer; min-height: 52px;
}
.nextbox .bt:hover { background: var(--brand-dark); }
.nextbox-done { background: var(--surface); border-color: var(--line); }
.nextbox-done .tt { font-size: .98rem; font-weight: 600; color: var(--ink-soft); }

/* Doi trang thai bang tay — thu gon lai, chi dung khi co ngoai le */
.manualstatus > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center;
  min-height: 44px; padding: .5rem .8rem; border: 1px dashed var(--line); border-radius: 10px;
  font-size: .88rem; font-weight: 600; color: var(--ink-soft);
}
.manualstatus > summary::-webkit-details-marker { display: none; }
.manualstatus[open] > summary { margin-bottom: .7rem; }

/* Man hinh goi khach */
.callcard { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; margin-bottom: .9rem; }
.callcard .hd { padding: .7rem .9rem; background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 700; }
.callcard .ln { display: flex; justify-content: space-between; gap: .8rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line); font-size: .95rem; }
.callcard .ln:last-child { border-bottom: 0; }
.callcard .ln span { color: var(--ink-soft); flex: 0 0 auto; }
.callcard .ln b { font-weight: 600; text-align: right; }
.calldial {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; min-height: 60px; margin-bottom: .9rem;
  background: var(--ok); color: #fff; border-radius: 14px;
  font-size: 1.1rem; font-weight: 700; text-decoration: none;
}

/* ---------- The tinh trang may (quet tem la thay ngay) ---------- */
.statecard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; margin-bottom: .9rem;
}
.statecard .bg {
  background: var(--brand-soft); color: var(--brand-dark);
  font-weight: 700; font-size: 1.02rem; text-align: center; padding: .7rem;
}
.statecard .ln {
  display: flex; justify-content: space-between; gap: .8rem;
  padding: .5rem .85rem; border-top: 1px solid var(--line); font-size: .93rem;
}
.statecard .ln span { color: var(--ink-soft); flex: 0 0 auto; }
.statecard .ln b { font-weight: 600; text-align: right; word-break: break-word; }
.statecard .tl { padding: .6rem .85rem; border-top: 1px solid var(--line); background: var(--surface); }
.statecard .tl .lb {
  display: block; font-size: .7rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: .35rem;
}
.statecard .tl div {
  display: flex; gap: .6rem; font-size: .84rem; color: var(--ink-soft);
  padding: .18rem 0 .18rem .6rem; border-left: 2px solid var(--line);
}
.statecard .tl div i { font-style: normal; font-family: ui-monospace, Menlo, monospace; font-size: .76rem; flex: 0 0 92px; }
.statecard .ac { display: flex; gap: .4rem; flex-wrap: wrap; padding: .6rem .85rem; border-top: 1px solid var(--line); }

/* ---------- Bao hanh quay lai: ai da sua may nay ---------- */
.bigname { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.okline { background: var(--ok-soft); color: var(--ok); border-radius: 8px; padding: .45rem .7rem; font-size: .9rem; }
.techpick { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .5rem; }
.techpick form { margin: 0; }

/* ---------- Yeu cau lay linh kien ---------- */
.preq {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 12px; padding: .7rem .85rem; margin-bottom: .7rem;
}
.preq-rush, .preq-ordered { border-left-color: var(--danger); }
.preq-received { border-left-color: var(--ok); }
.preq-cancelled { border-left-color: var(--line); opacity: .65; }
.preq-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.preq-form { margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--line); }
.preq-acts { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.rowform { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-top: .5rem; }
.rowform .field { flex: 1 1 160px; margin: 0; }

/* ---------- Hoa hong cua mot chiec may ---------- */
.commbox {
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
  background: var(--ok-soft); border: 1px solid var(--line); border-radius: 12px;
  padding: .6rem .85rem; margin-bottom: .9rem; font-size: .93rem;
}
.commbox b { font-size: 1.1rem; color: var(--ok); }
.commbox-no { background: var(--surface); color: var(--ink-soft); }

/* ---------- Dai ton: hien tren dau moi trang chu, ai cung thay ---------- */
.tonbar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: var(--brand-soft); color: var(--brand-dark);
  border: 1px solid var(--brand); border-left: 5px solid var(--brand);
  border-radius: 12px; padding: .7rem .9rem; margin-bottom: .9rem;
  text-decoration: none; font-size: .95rem;
}
.tonbar-vang { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.tonbar-do   { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.tonbar .tt { font-weight: 700; }
.tonbar .tt b { font-size: 1.25rem; }
.tonbar .tl { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .86rem; opacity: .95; }
.tonbar .tv b { font-weight: 700; }
.tonbar .ar { margin-left: auto; font-size: 1.2rem; }

/* Nhac rieng nguoi dang dang nhap: xac nhan con giu du may khong */
.tonack {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--warn); border-left: 5px solid var(--warn);
  border-radius: 12px; padding: .7rem .9rem; margin-bottom: .9rem;
}
.tonack .tx { flex: 1 1 240px; font-size: .95rem; }
.tonack .btn { margin: 0; }
.mt { margin-top: 1.2rem; }
