/* MechLV — giao diện kiểm tra cơ khí: gọn, số liệu rõ, thao tác bàn phím.
   Nhận diện theo cokhilocvinh.com (navy #0b1424 + cam #f2681c, Be Vietnam Pro);
   xem mockups/ để thấy bản thiết kế trước khi áp. */
@import url('/static/vendor/fonts/fonts.css');

:root {
  /* Nền & chữ — cùng bảng màu website */
  --bg: #f4f7fb;
  --soft: #f4f7fb;
  --soft-2: #eef3f9;
  --card: #ffffff;
  --line: #e3e9f1;
  --line-2: #dce4ee;
  --text: #3c4c63;
  --head: #0b1424;
  --ink-2: #111e33;
  --ink-3: #1b2c45;
  --muted: #66788f;
  --faint: #93a3b8;

  /* Cam thương hiệu = màu hành động chính */
  --accent: #f2681c;
  --accent-2: #d9560e;
  --accent-light: #ff8a3d;
  --accent-soft: #fff1e7;

  /* Xanh dương: thông tin / phương tiện (không còn là màu nút) */
  --info: #2f6fb2;
  --info-soft: #eaf2fb;

  /* Ngữ nghĩa QC — giữ nguyên để người dùng không phải học lại */
  --pass: #0f7a55;
  --pass-bg: #e4f5ec;
  --fail: #c22b2b;
  --fail-bg: #fdecec;
  --warn: #8a6413;
  --warn-bg: #fdf5e0;
  --purple: #6b3fa0;
  --purple-bg: #f1ebfa;

  --radius: 14px;
  --radius-sm: 10px;
  --container: 1400px;
  --sh-sm: 0 1px 2px rgba(11, 20, 36, .06);
  --sh: 0 18px 40px -26px rgba(11, 20, 36, .38);
  --ui: "Be Vietnam Pro", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.6 var(--ui);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(242, 104, 28, .22); color: var(--head); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  color: var(--head);
  box-shadow: var(--sh);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

a { color: var(--info); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: none; }

h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--head); margin: 0 0 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; color: var(--head); margin: 0; }
h3, h4 { font-weight: 700; color: var(--head); }

.mono { font-family: var(--mono); font-variant-ligatures: none; }

/* --- Header trắng dính trên cùng ----------------------------------------- */
.chrome { position: sticky; top: 0; z-index: 20; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(6px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; color: var(--head); }
.brand:hover { color: var(--head); }
.brand img { width: 30px; filter: drop-shadow(0 5px 10px rgba(11, 20, 36, .14)); }
.brand .btxt { display: flex; flex-direction: column; line-height: 1.1; }
.brand .btxt strong { font-size: 15px; font-weight: 800; letter-spacing: .01em; }
.brand .btxt strong span { color: var(--accent); }
.brand .btxt small {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8b9cb2;
  margin-top: 3px;
}
.topbar nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.topbar nav a {
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 12.8px;
  font-weight: 600;
  color: #46586f;
  white-space: nowrap;
}
.topbar nav a:hover { background: var(--bg); color: var(--head); text-decoration: none; }
.topbar nav a.is-active { background: var(--accent-soft); color: var(--accent-2); }
.topbar .divider { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.topbar .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #1b2c45, var(--head));
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}

/* Menu tài khoản: bấm avatar góc phải ⇒ Đổi mật khẩu / Đăng xuất. <details> nên chạy cả khi tắt JS. */
.acct { position: relative; flex: none; margin-left: auto; }
.acct > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover, .acct[open] > summary { background: var(--bg); border-color: var(--line); }
.acct .t { display: flex; flex-direction: column; line-height: 1.15; }
.acct .t b { font-size: 12.3px; font-weight: 600; color: var(--head); }
.acct .t small { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.acct .caret { width: 12px; height: 12px; color: var(--faint); transition: transform .15s; }
.acct[open] .caret { transform: rotate(180deg); }
.acct-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 240px;
  max-width: calc(100vw - 28px);
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--sh), var(--sh-sm);
}
.acct-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.acct-head .avatar { width: 32px; height: 32px; font-size: 12px; flex: none; }
.acct-head b { display: block; font-size: 13px; font-weight: 700; color: var(--head); }
.acct-head small { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }
.acct-menu form { margin: 0; }
.acct-menu a, .acct-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--bg); color: var(--head); text-decoration: none; }
.acct-menu svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.acct-menu button:hover, .acct-menu button:hover svg { color: var(--fail); }
.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;
}
.topbar .hint { font-size: 12px; color: var(--muted); }

.crumbs {
  max-width: var(--container, 1400px);
  margin: 0 auto;
  padding: 12px 20px 0;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12.5px;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

.wrap { max-width: var(--container, 1400px); margin: 0 auto; padding: 16px 20px 52px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 10px 0 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; margin-bottom: 2px; }
.page-head .lead { margin-top: 5px; font-size: 12.8px; color: var(--muted); }
.lead { margin: 4px 0 0; font-size: 12.8px; color: var(--muted); }
.page-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.order-hero-side { display: flex; align-items: center; gap: 10px; margin-top: 6px; }

/* Nhãn nhỏ phía trên tiêu đề — kiểu .eyebrow của website */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(242, 104, 28, .14); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  padding: 16px;
  margin-bottom: 16px;
}
.card + .card { margin-top: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: -16px -16px 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.card-head h2 { font-size: 13.5px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-right: auto; }
.card-head .actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.card-head .sub, .card .sub { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.card-body { padding: 16px; }
.card-body.tight { padding: 10px 12px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--soft); font-size: 12px; color: var(--muted); }
/* Bảng và footer "tràn lề" trong card có padding 16px — kéo sát viền như mockup. */
.card > .tbl-wrap, .card > .table { margin: 0 -16px; }
.card > .card-foot { margin: 14px -16px -16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }

.head-card { padding: 18px 20px; }
.head-main { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.head-card .note {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: var(--soft);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  white-space: pre-wrap;
}

.kv { display: flex; gap: 22px; margin: 0; flex-wrap: wrap; }
.kv div { display: flex; flex-direction: column; gap: 2px; }
.kv dt { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kv dd { margin: 0; font-size: 13px; font-weight: 600; color: var(--head); font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.w40 { width: 40px; }
.w110 { width: 110px; }
.w240 { width: 240px; }
.w300 { width: 320px; }

/* badges & verdict */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge.b-empty::before { display: none; }
.b-gray { background: var(--soft-2); color: #4a5563; border-color: var(--line); }
.b-blue { background: var(--info-soft); color: #1f5c99; }
.b-indigo { background: #e9ecfd; color: #333fa8; }
.b-amber { background: var(--warn-bg); color: var(--warn); }
.b-purple { background: var(--purple-bg); color: var(--purple); }
.b-green { background: var(--pass-bg); color: var(--pass); }
.b-teal { background: #e0f4f3; color: #0f6f6a; }
.b-orange { background: var(--accent-soft); color: var(--accent-2); }
.b-red { background: var(--fail-bg); color: var(--fail); }
.b-empty { background: transparent; color: var(--muted); border-color: var(--line); }

.verdict {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 2px 9px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.v-pass { background: var(--pass-bg); color: var(--pass); }
.v-fail { background: var(--fail-bg); color: var(--fail); }
.v-pending { background: #f1f3f6; color: var(--muted); }
.v-na { background: #eef1f4; color: #4a5563; }


/* buttons & inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--head);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, transform .18s, box-shadow .18s;
}
.btn:hover { background: var(--soft); border-color: #c9d5e3; color: var(--head); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 20px -12px rgba(242, 104, 28, .9);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 14px 24px -12px rgba(242, 104, 28, .95);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--soft); color: var(--head); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.input, .select, .textarea {
  padding: 8px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--head);
  font: inherit;
  font-size: 13px;
  min-width: 0;
  transition: border-color .16s, box-shadow .16s;
}
.textarea { resize: vertical; min-height: 72px; }
.input::placeholder, .textarea::placeholder { color: #a7b5c6; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 104, 28, .14);
}
.input:disabled, .select:disabled { background: #f5f7fa; color: var(--muted); }
.input.grow, .select.grow { flex: 1; }
.hint { font-size: 11px; color: var(--faint); }
.nowrap { white-space: nowrap; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.form-grid .field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.field.grow { flex: 1 1 220px; }
.field > label, .label { font-size: 11.5px; font-weight: 600; color: #46586f; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: span 3; }
.form-grid .actions { display: flex; justify-content: flex-end; }
.form-card { max-width: 720px; }
.form-stack { display: grid; gap: 14px; }
.form-stack .actions { display: flex; justify-content: flex-end; }
.form-note { margin: 14px 0 0; }
.table-note { margin: 12px 0 0; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

details.create { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
details.create > summary { cursor: pointer; color: var(--accent); }
details.create[open] > summary { margin-bottom: 12px; }

/* tables */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfcfe; }
.table.compact td, .table.compact th { padding: 6px 9px; }
.table .empty { padding: 26px; text-align: center; color: var(--muted); }
.table .code { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--head); white-space: nowrap; }
/* Chấm đỏ: khách phản hồi qua link chia sẻ mà xưởng chưa xem (báo giá). */
.new-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--fail); margin-left: 5px; vertical-align: 1px; }
.table tr.row-new > td { background: var(--blue-soft); }
.table .strong { font-weight: 600; color: var(--head); }
.table tr.is-active td { background: var(--accent-soft); }
.table tr.is-active td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tbl-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
/* Trong card, khung bảng tràn lề 16px mỗi bên (dòng 278) ⇒ rộng hơn 100% của card;
   giữ max-width: 100% sẽ để hở 32px bên phải. */
.card > .tbl-wrap { max-width: none; }
.tbl-wrap > .table { min-width: 680px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.progress { height: 6px; background: var(--soft-2); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-light), var(--accent)); }
.progress.is-green span { background: linear-gradient(90deg, #45b98a, var(--pass)); }
.progress.is-red span { background: linear-gradient(90deg, #e26a6a, var(--fail)); }
.progress.slim { height: 4px; margin-top: 4px; margin-bottom: 2px; }
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter .progress { flex: 1; margin-bottom: 0; }
.meter b { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--head); }

.tag-crit {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #a3231f;
  border: 1px solid #f0c2c0;
  background: #fff5f4;
  padding: 0 5px;
  border-radius: 4px;
  vertical-align: 1px;
}
/* Nhãn nhỏ dạng mono (máy gia công, kho, vật liệu…) — cùng họ với .tag của mockup. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5f7290;
}
.tag-danger { color: var(--fail); font-size: 11px; font-weight: 700; margin-left: 4px; }
.danger { color: var(--fail); }

/* KPI — 4 ô số liệu trên dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-sm);
  padding: 13px 15px;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi.k-green::before { background: var(--pass); }
.kpi.k-red::before { background: var(--fail); }
.kpi.k-blue::before { background: var(--info); }
.kpi.k-purple::before { background: var(--purple); }
.kpi .k-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.kpi .k-value { margin-top: 4px; font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--head); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .k-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi .k-meta { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.kpi .k-meta b { color: var(--head); font-weight: 600; }

/* Cảnh báo 4 mức (alert) — dùng cho lỗi form, dụng cụ hết hạn, gợi ý. */
.alert { display: flex; gap: 9px; padding: 10px 13px; border-radius: var(--radius-sm); font-size: 12.8px; line-height: 1.5; margin: 0 0 12px; }
.alert + .alert { margin-top: 0; }
.alert-err { background: var(--fail-bg); color: #a92222; border: 1px solid #f3cccc; border-left: 3px solid var(--fail); font-weight: 600; }
.alert-warn { background: var(--warn-bg); color: #7a5811; border: 1px solid #f0e2bb; border-left: 3px solid #d9a72b; }
.alert-ok { background: var(--pass-bg); color: #0e6a4b; border: 1px solid #c6e9d8; border-left: 3px solid var(--pass); }
.alert-info { background: var(--info-soft); color: #1f5c99; border: 1px solid #cfe2f5; border-left: 3px solid var(--info); }
.alert b { font-weight: 700; }

/* Thanh bước trạng thái đơn (Mở → Đang gia công → Kiểm → Duyệt → Giao). */
.progress-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--faint); }
.step i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--soft-2); color: #8b9cb2; font-family: var(--mono); font-size: 9.5px; font-style: normal; }
.step.done { color: var(--head); }
.step.done i { background: var(--pass-bg); color: var(--pass); }
.step.now { color: var(--accent-2); }
.step.now i { background: var(--accent); color: #fff; }
.step-line { width: 16px; height: 1px; background: var(--line-2); }

/* Danh sách tệp trên trang đơn / trang chi tiết */
.file-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.file-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
}
.file-list li:hover { border-color: #cfdcea; background: #fff; }
.file-list .muted { flex: 1; }

/* Khối xoá mềm ở cuối header — mặc định gập lại, chữ đỏ. */
.delete-zone {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}
.delete-zone > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12.5px;
}
.delete-zone > summary::-webkit-details-marker { display: none; }
.delete-zone[open] { background: #fffafa; border-radius: var(--radius-sm); padding: 10px 12px; }

/* Dòng/rảnh "chưa có dữ liệu" ngoài bảng. */
.empty { padding: 18px 4px; color: var(--muted); font-size: 13px; }

/* trang kiểm tra: viewer trái, checklist phải */
.inspect-grid {
  display: grid;
  grid-template-columns: minmax(380px, 42%) minmax(520px, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 1180px) {
  .inspect-grid { grid-template-columns: 1fr; }
  .viewer { position: static; }
  .form-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .form-grid .span3 { grid-column: span 2; }
}

.viewer { position: sticky; top: 108px; }
.pdf-frame {
  width: 100%;
  height: 68vh;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9edf2;
}
.placeholder {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 26px 18px;
  text-align: center;
  background: #fafbfd;
}
.placeholder p { margin: 4px 0; }
.upload { display: flex; gap: 8px; margin-top: 12px; }
.upload .input { flex: 1; min-width: 0; }

/* checklist */
.summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f4f6f9;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--muted);
  white-space: nowrap;
}
.chip b { color: var(--head); font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-pass { background: var(--pass-bg); border-color: #c6e9d8; color: var(--pass); }
.chip-pass b { color: var(--pass); }
.chip-fail { background: var(--fail-bg); border-color: #f3cccc; color: var(--fail); }
.chip-fail b { color: var(--fail); }
.chip-pending { background: var(--warn-bg); border-color: #f0e2bb; color: var(--warn); }
.chip-pending b { color: var(--warn); }

.checklist-head .actions { justify-content: flex-end; }
.checklist-scroll > .checklist-table { min-width: 640px; }
.checklist-table td { vertical-align: middle; }
.group-row td {
  background: #f7f9fc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5a6675;
  padding: 6px 10px;
}
.override { width: 100%; margin-top: 4px; font-size: 11px; padding: 3px 6px; }
.checklist-table .item-row.vrow-fail { background: #fffafa; }
.checklist-table .item-row.vrow-pass { background: #fbfefc; }
.item-label { font-weight: 600; }
.item-spec { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-spec .dot { margin: 0 6px; color: #b9c2cd; }

/* sửa / xoá mục kiểm tra (form nằm trong ô "Mục kiểm tra", không thêm cột) */
.item-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; margin-top: 6px; }
.item-edit > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 18px;
  color: var(--accent);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  padding: 0 6px;
}
.item-edit > summary::-webkit-details-marker { display: none; }
.item-edit[open] { flex: 1 1 100%; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; }
.item-edit .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.item-edit .form-grid .span3 { grid-column: span 2; }
.item-delete { margin: 0; }
.tag-edit {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #6b4b00;
  border: 1px solid #f0d9a0;
  background: #fffaf0;
  padding: 0 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: 1px;
}

.measure { display: flex; gap: 6px; align-items: center; }
.measure .measured { width: 110px; font-family: var(--mono); font-size: 14px; font-weight: 600; }
.measure .note { flex: 1; min-width: 70px; font-size: 12px; }
.verdict-cell { width: 110px; }

.check-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.check-actions .inline-form { margin-top: 0; }
.chips { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 10px; width: 1px; background: var(--line-2); }
.timeline li { position: relative; padding: 0 0 13px; font-size: 13px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}
.timeline li.t-green::before { border-color: var(--pass); }
.timeline li.t-red::before { border-color: var(--fail); }
.timeline li.t-gray::before { border-color: #c3cedb; }
.timeline .when { font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; color: var(--faint); }
.timeline .what { font-size: 12.8px; color: var(--head); font-weight: 600; margin-top: 1px; }
.timeline .who { color: var(--muted); font-size: 11.8px; margin-top: 1px; }
.timeline .why { color: var(--muted); font-size: 11.8px; margin-top: 1px; }

/* trang lỗi */
.err-page { min-height: 100vh; padding: 0 16px; overflow: hidden; }
.err-card {
  max-width: 560px;
  margin: 12vh auto;
  padding: 32px 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-sm);
}
.err-card .err-logo { width: 44px; height: 44px; display: block; margin: 0 auto 16px; }
.err-code { font-family: var(--mono); font-size: 42px; font-weight: 800; color: var(--accent); margin: 0; line-height: 1; }
.err-card h1 { font-size: 19px; margin: 10px 0 6px; justify-content: center; }
.err-msg { color: var(--muted); font-size: 12.8px; margin: 0; overflow-wrap: anywhere; }
.err-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }


/* tab Bản vẽ / 3D trên trang kiểm tra */
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1f5;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--sh-sm);
}
/* tab dạng link giữa các trang quản trị */
.tabs-nav { max-width: 100%; overflow-x: auto; margin: 0 0 14px; scrollbar-width: none; }
.tabs-nav::-webkit-scrollbar { display: none; }
.tabs-nav .tab { display: inline-flex; align-items: center; white-space: nowrap; text-decoration: none; padding: 5px 14px; font-size: 12.5px; }
.tabs-nav .tab:hover { text-decoration: none; }
.pane[hidden] { display: none; }
.cad-host {
  position: relative;
  width: 100%;
  height: 68vh;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f5f8;
  overflow: hidden;
}
.cad-host canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.cad-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.cad-bar #cad-status { flex: 1 1 auto; min-width: 180px; }
.cad-bar label { display: inline-flex; align-items: center; gap: 5px; }

/* --- Soát bản vẽ tổng hợp --- */
.row-warn { background: #fff8e1; }
.warn-list {
  margin: .25rem 0 0;
  padding-left: 1.1rem;
  color: #8a6d00;
  font-size: .78rem;
  line-height: 1.35;
}
.warn-list li { margin: .1rem 0; }

/* --- Soát thông số trích từ bản vẽ (Phase 2) --- */
/* Dòng đã tạo mục kiểm tra: xám đi để phân biệt với dòng còn chờ quyết định. */
.row-done { background: #f4f6f8; color: #5b6670; }
.row-done td { opacity: .85; }
/* Dòng đã loại: vẫn liệt kê để đối chiếu, nhưng mờ đi và không có ô tick. */
.row-reject { background: #f7f7f8; color: #98a0a8; }
.row-reject td { opacity: .7; }
.row-reject strong { text-decoration: line-through; }
/* Cờ cảnh báo ngắn ngay trong ô "Cần chú ý". */
.warn-inline {
  color: #8a6d00;
  font-size: .76rem;
  line-height: 1.3;
}
/* Nút nhỏ đặt cạnh từng dòng (Loại / Hồi phục). */
.btn-mini {
  padding: .1rem .45rem;
  font-size: .74rem;
  line-height: 1.4;
}


/* --- Pin kích thước trên ảnh bản vẽ (Phase 2.5) --- */
/* Ảnh phải là block + đúng 100% bề ngang, nếu không baseline của ảnh inline sẽ
   đẩy mọi khung lệch xuống vài px và % của overlay không còn khớp. */
.pin-stage { position: relative; }
.pin-img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.pin {
  position: absolute;
  display: block;
  border: 1.5px solid var(--accent);
  background: rgba(242, 104, 28, .10);
  border-radius: 3px;
  text-decoration: none;
}
.pin:hover { background: rgba(242, 104, 28, .22); }
.pin-no {
  position: absolute;
  top: -9px;
  left: -5px;
  padding: 1px 3px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: var(--accent);
  border-radius: 3px;
}
.pin-crit { border-color: #a3231f; background: rgba(163, 35, 31, .10); }
.pin-crit .pin-no { background: #a3231f; }
.pin-fail { border-color: var(--fail); background: rgba(194, 43, 43, .16); }
.pin-fail .pin-no { background: var(--fail); }
.pin-jump {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  vertical-align: 1px;
}
.pin-jump:hover { color: var(--accent-2); }
.pin-flash { animation: pin-flash 1.2s ease-out; }
.row-flash { animation: row-flash 1.2s ease-out; }
@keyframes pin-flash {
  0% { outline: 3px solid #f59e0b; }
  100% { outline: 3px solid transparent; }
}
@keyframes row-flash {
  0% { background: #fff7d6; }
  100% { background: transparent; }
}

/* --- Đối chiếu mô hình STEP (Phase 3) --- */
/* Chip đặc trưng: xanh = bản vẽ có con số khớp mô hình, vàng = chỉ mô hình có,
   xám = trục tròn xoay (không đo được từ đỉnh nên không đem ra so). */
.chip-hit,
.chip-miss,
.chip-skip {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chip-hit {
  background: var(--pass-bg);
  border: 1px solid #c7e8d8;
  color: var(--pass);
}
.chip-miss {
  background: var(--warn-bg);
  border: 1px solid #efe0b4;
  color: var(--warn);
}
.chip-skip {
  background: #f4f6f9;
  border: 1px solid var(--line);
  color: #98a0a8;
}
/* Dấu "mô hình 3D xác nhận" trong cột 3D của bảng ứng viên — cùng tông chữ nhỏ
   với .tag-crit / .tag-edit nhưng màu xanh để không lẫn với cảnh báo. */
.tag-3d {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #17603a;
  border: 1px solid #b9e0cb;
  background: #f2fbf6;
  padding: 0 5px;
  border-radius: 4px;
  vertical-align: 1px;
  white-space: nowrap;
}
.model-unlinked,
.model-fillets { margin-top: 6px; }
.model-unlinked ul { margin: 4px 0 0 16px; padding: 0; }

/* Dụng cụ đo + hạn hiệu chuẩn (P2). */
.item-equipment { margin-top: 4px; }
.select-sm { font-size: 12px; padding: 2px 4px; max-width: 260px; }
.cal-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.cal-ok      { color: #1c6b3a; border-color: #bfe0cb; background: #f1faf4; }
.cal-due     { color: #8a5a00; border-color: #f0d9a8; background: #fff9ec; }
.cal-expired { color: #a3231f; border-color: #f0c2c0; background: #fff5f4; font-weight: 700; }
.cal-none    { color: #6b7683; }
tr.cal-expired-row > td { background: #fff5f4; }

/* Nhiều lần đo + thống kê (P3). */
.readings-stats {
  margin-top: 3px;
  font-size: 11px;
  color: #46525e;
  background: #f5f7f9;
  border-radius: 4px;
  padding: 1px 5px;
  display: inline-block;
}
.readings-list { margin-top: 4px; font-size: 12px; }
.readings-list summary { cursor: pointer; color: #46525e; }
.readings-list ol { margin: 4px 0 4px 18px; padding: 0; }
.readings-list li { margin: 1px 0; }
.deleted-items { list-style: none; margin: 4px 0 0; padding: 0; }
.deleted-items li { display: flex; align-items: center; gap: 8px; margin: 2px 0; }



/* Dashboard "sẵn sàng giao" (P7.3). */
.dash-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.dash-order { padding: 10px 12px; margin-bottom: 10px; }
.dash-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dash-head .badge { margin-left: 4px; }
/* Dòng thứ hai của mỗi đơn: bảng chi tiết lồng, nền xám nhẹ cho rõ nhóm. */
.dash-parts-row > td { padding: 0 12px 10px; background: #fbfcfe; }
.dash-parts-row:hover > td { background: #fbfcfe; }
.dash-parts { margin-top: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.dash-parts td { padding: 5px 10px; }
.chip-wait { background: var(--warn-bg); border-color: #f0e2bb; color: #8a5a00; }
.chip-none { background: var(--soft-2); border-color: var(--line); color: #6b7683; }

/* Lịch sử thay đổi (P7.4): vạch màu theo nhóm — trạng thái / sửa mục / số đo. */
.history td { vertical-align: top; }
.history .nowrap { white-space: nowrap; }
.history tr.h-status td:first-child { box-shadow: inset 3px 0 0 var(--purple); }
.history tr.h-items td:first-child { box-shadow: inset 3px 0 0 #c9d2dc; }
.history tr.h-measure td:first-child { box-shadow: inset 3px 0 0 var(--pass); }

/* Trình sửa template (P7.5). */
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; font-size: 13px; }
form.inline { display: inline; margin: 0; }
.tpl-items td { vertical-align: top; }
.tpl-items .mono { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.tpl-items .nowrap { white-space: nowrap; }
.table tr.row-selected td { background: #f4f7fb; font-weight: 600; }

/* Gắn tay solid ↔ chi tiết trên trang đơn. */
.solid-links { margin-top: 6px; }
.solid-links td { padding: 4px 8px; vertical-align: middle; }
.solid-links tr.unlinked td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.solid-links form { margin: 0; }

/* /admin/ai — thử AI đọc bản vẽ */
.ok-msg { color: var(--pass); font-weight: 600; margin: 0; }
.ai-prompt { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; }
.ai-pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: #f6f8fa; border: 1px solid var(--line, #e6eaee); border-radius: 6px; padding: 10px; max-height: 480px; overflow: auto; }
.ai-head-actions { display: flex; align-items: center; gap: 12px; }
.ai-form { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
.ai-form .span4 { grid-column: 1 / -1; }
.ai-tick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  color: var(--text);
  font-size: 13px;
  margin-top: 4px;
}
.ai-tick input { margin: 0; }
.ai-model-row { display: flex; align-items: center; gap: 8px; }
.ai-model-row .select { flex: 1; min-width: 0; }
.ai-model-row .btn { white-space: nowrap; }
.ai-default-prompt { margin-top: 4px; }
.ai-hints { margin: 12px 0 0; }
.ai-form .field .muted { font-weight: 400; }
.ai-checks { table-layout: fixed; }
.ai-checks th:nth-child(1), .ai-checks td:nth-child(1) { width: 32px; }
.ai-checks th:nth-child(2) { width: 32%; }
.ai-checks th:nth-child(3), .ai-checks td:nth-child(3) { width: 110px; text-align: center; }
.ai-checks .chip { display: inline-block; min-width: 76px; text-align: center; }
.ai-checks th:nth-child(5), .ai-checks td:nth-child(5) { width: 80px; }
.ai-check-detail { color: var(--muted); word-break: break-word; }
.ai-check-ms { color: var(--muted); white-space: nowrap; }
#ai-check-summary { margin: 8px 0 0; }
@media (max-width: 1180px) {
  .ai-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-form .span2, .ai-form .span4 { grid-column: 1 / -1; }
}
.ai-result { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.3fr); gap: 16px; align-items: start; }

.ai-image { margin: 0; position: sticky; top: 108px; }
.ai-image img { width: 100%; border: 1px solid var(--line, #e6eaee); border-radius: 6px; background: #fff; }
@media (max-width: 1180px) { .ai-result { grid-template-columns: 1fr; } .ai-image { position: static; } }
.ai-err { color: var(--fail); font-weight: 600; }

/* ===== Trang đăng nhập (/login) ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  padding: 24px;
  background:
    radial-gradient(900px 520px at 10% -10%, #dfe8f7 0%, rgba(223, 232, 247, 0) 70%),
    radial-gradient(720px 440px at 100% 100%, #e6eefb 0%, rgba(230, 238, 251, 0) 65%),
    var(--bg);
}

.login-shell {
  width: min(980px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1fr);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 26px 60px -28px rgba(15, 23, 42, .45), 0 2px 6px rgba(15, 23, 42, .05);
}

/* Nửa trái: nhận diện thương hiệu trên nền tối (cùng tông với .topbar). */
.login-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 34px 34px 30px;
  background: linear-gradient(155deg, var(--ink-2) 0%, var(--ink-3) 55%, #24405f 100%);
  color: #cfd8e6;
}
.login-hero::before {
  content: "";
  position: absolute;
  top: -130px;
  right: -140px;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 157, 255, .35), rgba(91, 157, 255, 0) 70%);
  pointer-events: none;
}
.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(circle at 18% 8%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 18% 8%, #000 0%, transparent 72%);
  pointer-events: none;
}
.login-hero > * { position: relative; z-index: 1; }
.login-brand { font-size: 18px; }

.login-hero-body { margin: auto 0; }
.login-kicker {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #7fb0ff;
}
.login-claim {
  display: block;
  margin: 0 0 10px;
  font-size: 25px;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: #fff;
}
.login-hero-text { margin: 0; font-size: 13px; line-height: 1.6; color: #a9b8cc; }
.login-points {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #b9c6d8;
}
.login-points li { display: flex; gap: 9px; align-items: flex-start; }
.login-points li::before {
  content: "✓";
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1px solid rgba(91, 157, 255, .45);
  background: rgba(91, 157, 255, .16);
  color: #9cc4ff;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}
.login-hero-foot { margin: 0; font-size: 11.5px; line-height: 1.5; color: #7d8ca3; }

/* Nửa phải: form. */
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 36px; }
.login-box { width: 100%; max-width: 360px; }
.login-title {
  margin: 0 0 4px;
  font-size: 20px;
  text-transform: none;
  letter-spacing: -.01em;
  color: var(--text);
}
.login-sub { margin: 0 0 20px; font-size: 13px; }

.login-alert {
  margin: 0 0 16px;
  padding: 9px 12px;
  border: 1px solid #f0c9c9;
  border-left: 3px solid var(--fail);
  border-radius: 8px;
  background: var(--fail-bg);
  color: #a92222;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.login-form { display: grid; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label { font-size: 12px; font-weight: 600; color: #43505f; }
.login-input { padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 104, 28, .14);
}

.login-pw { position: relative; display: flex; }
.login-pw .login-input { flex: 1; }
.login-pw.pw-js .login-input { padding-right: 62px; }
.login-pw-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.login-pw-toggle[hidden] { display: none; }
.login-pw-toggle:hover { background: #eef1f5; color: var(--text); }
.login-pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.login-submit {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 14px;
  box-shadow: 0 8px 18px -10px rgba(242, 104, 28, .85);
}
.login-submit:hover { box-shadow: 0 10px 22px -10px rgba(242, 104, 28, .95); }
.login-help { margin: 16px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }

@media (max-width: 860px) {
  .login-page { padding: 0; }
  .login-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .login-hero { gap: 14px; padding: 22px 22px 20px; }
  .login-hero-body { margin: 0; }
  .login-claim { font-size: 20px; margin-bottom: 6px; }
  .login-points, .login-hero-foot { display: none; }
  .login-panel { align-items: flex-start; padding: 26px 22px 40px; }
}

/* ===== RESPONSIVE cho khung trang mới ===== */
@media (max-width: 1240px) {
  .topbar { gap: 12px; }
  .topbar nav a { padding: 7px 9px; font-size: 12.2px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .split { grid-template-columns: 1fr; }
  .viewer, .ai-image { position: static; }
  .topbar { flex-wrap: wrap; gap: 8px 14px; padding-top: 10px; }
  .topbar nav {
    order: 3;
    flex: 1 0 100%;
    overflow-x: auto;
    padding-bottom: 9px;
    scrollbar-width: thin;
  }
  .topbar nav a { flex: none; }
}
@media (max-width: 860px) {
  .kpis, .g3, .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wrap { padding: 12px 14px 44px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .acct .t { display: none; }
  .crumbs { padding: 10px 14px 0; overflow-x: auto; white-space: nowrap; }
  .page-head { margin-top: 8px; }
  .card-head { align-items: flex-start; }
  .checklist-head .actions { justify-content: flex-start; }
  .progress-steps { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .progress-steps .step, .progress-steps .step-line { flex: none; }
}
@media (max-width: 620px) {
  .kpis { grid-template-columns: 1fr; gap: 10px; }
  .topbar .brand .btxt small { display: none; }
  .topbar .brand img { width: 28px; }
  .acct > summary { gap: 4px; padding-right: 6px; }
  .page-head h1, h1 { font-size: 20px; }
  .head-card { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .form-grid .span3,
  .item-edit .form-grid .span3 { grid-column: 1 / -1; }
  .item-edit .form-grid { grid-template-columns: 1fr; }
  .form-row .field.grow { flex-basis: 100%; }
  .form-actions .btn { flex: 1 1 auto; }
  .upload { flex-wrap: wrap; }
  .upload .input { flex-basis: 100%; }
  .head-main .inline-form { width: 100%; }
  .head-main .inline-form .select { max-width: 100%; }
  .kv { gap: 14px 20px; }
  .card-head .actions { width: 100%; }
  .alert { align-items: flex-start; }
}

/* ==========================================================================
   Khu "Báo giá tạm tính" (/quotes) — theo mockups/quote-*.html, pricing.html
   ========================================================================== */

/* Dải nhắc "chỉ tham khảo" — sọc chéo nhẹ để không lẫn với alert thường */
.ref-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; margin-bottom: 14px;
  border: 1px dashed #e4c27a; border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(135deg, rgba(217, 167, 43, .07) 0 10px, transparent 10px 20px),
    var(--warn-bg);
  color: #6f5110; font-size: 12.5px;
}
.ref-banner b { color: #5c430c; }
.ref-banner .mono { font-size: 11px; }
.ref-banner .push { margin-left: auto; }

/* Bố cục làm việc của một dòng: xem tệp trái, tính toán phải */
.q-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 16px; align-items: start; }
.q-col { display: grid; gap: 14px; min-width: 0; }
.q-col > .card { margin-bottom: 0; }
.tbl-wrap > .table.q-items { min-width: 860px; }
.q-part { display: flex; align-items: center; gap: 10px; }
.q-part .t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.q-part .t b { color: var(--head); font-weight: 600; font-size: 12.8px; }
.q-part a { color: inherit; text-decoration: none; }
.q-part a:hover b { color: var(--accent-2); }
.q-page { display: block; width: 100%; max-height: 72vh; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.q-files { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; }
.q-files a { white-space: nowrap; }
.tbl-wrap > .table.q-facts { min-width: 0; }
.q-facts td:last-child, .q-facts th:last-child { width: 1%; white-space: nowrap; }
.form-grid .actions { align-items: flex-end; }

/* Nguồn dữ liệu: chip rất nhỏ cạnh từng giá trị */
.src { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 6px;
  font: 600 9.5px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.src-step { background: var(--info-soft); color: #1f5c99; }
.src-pdf { background: var(--soft-2); color: #4a5563; }
.src-hand { background: var(--accent-soft); color: var(--accent-2); }

/* Bảng tạm tính: nhãn · công thức · số tiền */
.calc { width: calc(100% + 32px); margin: 0 -16px; border-collapse: collapse; }
.calc td { padding: 8px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.calc tr:last-child td { border-bottom: 0; }
.calc .lbl { color: var(--head); font-weight: 600; font-size: 12.8px; }
.calc .how { display: block; margin-top: 2px; font: 11px/1.5 var(--mono); color: var(--muted); }
.calc .amt { text-align: right; font: 600 12.8px var(--mono); color: var(--head); white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc tr.sub td { background: var(--soft); }
.calc tr.sub .lbl, .calc tr.sub .amt { font-weight: 700; }
.calc tr.total td { background: var(--head); color: #fff; padding-top: 12px; padding-bottom: 12px; }
.calc tr.total .lbl { color: #fff; font-size: 13.5px; }
.calc tr.total .how { color: #93a3b8; }
.calc tr.total .amt { color: #fff; font-size: 17px; font-weight: 800; }
.calc tr.total .amt small { font-size: 11px; font-weight: 600; color: #93a3b8; margin-left: 3px; }
.calc-foot { margin: 0 -16px -16px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }

/* Thanh khoảng tham khảo thấp — đề xuất — cao, kèm vạch giá chốt */
.range-track { position: relative; height: 10px; border-radius: 999px; background: var(--soft-2); margin: 28px 0 8px; }
.range-band { position: absolute; top: 0; bottom: 0; border-radius: 999px;
  background: linear-gradient(90deg, rgba(242, 104, 28, .25), rgba(242, 104, 28, .55) 30%, rgba(242, 104, 28, .25)); }
.range-mark { position: absolute; top: -5px; width: 2px; height: 20px; margin-left: -1px; background: var(--accent); border-radius: 2px; }
.range-mark::after { content: attr(data-l); position: absolute; bottom: 23px; left: 50%; transform: translateX(-50%);
  font: 700 10.5px var(--mono); color: var(--accent-2); white-space: nowrap; }
.range-mark.final { background: var(--head); }
.range-mark.final::after { color: var(--head); bottom: auto; top: 23px; }
.range-legend { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--muted); margin-top: 26px; }

/* Bậc số lượng */
.breaks { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.breaks > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: #fff; }
.breaks > div.is-active { border-color: var(--accent); background: var(--accent-soft); }
.breaks .q { font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.breaks .p { font: 700 13.5px var(--mono); color: var(--head); margin-top: 2px; }
.q-notes { margin: 10px 0 0; padding-left: 18px; font-size: 11.8px; color: var(--muted); }

/* Thẻ giá chốt — điểm nhấn cam */
.final-card { border: 1.5px solid var(--accent); box-shadow: 0 18px 40px -30px rgba(242, 104, 28, .8); }
.final-card .card-head { background: var(--accent-soft); }
.money { position: relative; }
.money .input { width: 100%; font: 800 20px var(--mono); padding: 10px 44px 10px 12px; color: var(--head); letter-spacing: -.01em; }
.money .cur { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 13px var(--mono); color: var(--muted); }
.delta { display: inline-block; font: 600 11.5px var(--mono); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.delta.up { background: var(--pass-bg); color: var(--pass); }
.delta.down { background: var(--fail-bg); color: var(--fail); }
.final-sum { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--soft); }
.final-sum b { font: 800 17px var(--mono); color: var(--head); }
.stack { display: grid; gap: 12px; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Khu tải tệp */
.dropzone {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center;
  border: 1.5px dashed #b9c8da; border-radius: var(--radius); background: #fff; padding: 16px 18px;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); background: #fffaf6; }
.dropzone .dz-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); font-size: 20px; font-weight: 800; }
.dropzone h3 { font-size: 14px; margin: 0; color: var(--head); }
.dropzone p { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.dropzone input[type=file] { margin-top: 8px; max-width: 100%; font-size: 12.5px; }

/* Hộp thoại tạo đơn (mở bằng :target, không cần JS) */
.modal { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; padding: 16px;
  background: rgba(11, 20, 36, .52); }
.modal:target { display: grid; }
.modal > .card { width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--sh); margin: 0; }
.modal .card > * { min-width: 0; }

/* Trang bảng đơn giá */
.ver { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  background: var(--head); color: #fff; font: 600 11px var(--mono); vertical-align: middle; }
.stale { color: var(--warn); font-weight: 600; }
.price-tbl .input { padding: 5px 8px; font-size: 12.5px; min-width: 0; width: 100%; }
.price-tbl .input.num { text-align: right; font-family: var(--mono); }
.price-tbl td { vertical-align: top; }
.price-tbl tr.needs td { background: #fffaf0; }
.price-tbl tr.blank td { background: #fbfcfe; }
.price-tbl .idx { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.set-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 1080px) {
  .q-work { grid-template-columns: 1fr; }
  .set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .set-grid { grid-template-columns: 1fr; }
  .calc td { padding: 8px 12px; }
}

/* Hộp thoại "Chia sẻ kết quả QC cho khách" (#share-qc) — mockups/order-detail.html#share-qc */
.modal .card-body.share-dialog { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.share-dialog > * { min-width: 0; }
.lbl-sec { font: 600 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.share-warn { border: 1px solid #f0e2bb; background: var(--warn-bg); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 12.5px; color: #5c4a1a; margin: 0; }
.share-item { display: grid; gap: 8px; padding: 12px 0; border-top: 1px dashed var(--line); }
.share-item:first-of-type { border-top: 0; padding-top: 0; }
.share-link { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.share-link .input { flex: 1 1 320px; min-width: 0; font-family: var(--mono); font-size: 12.5px; background: var(--soft); color: var(--head); }
.share-meta { margin: 0; }
.share-meta b { color: var(--head); }
.share-tip { color: #1f5c99; margin: 0; }
.share-manage { display: flex; gap: 4px 18px; flex-wrap: wrap; align-items: center; }
.share-manage .inline-form { margin-top: 0; }
.share-manage .input[type=date] { width: auto; }
.share-manage .inline-form:has(.grow) { flex: 1 1 300px; }
.share-new { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.share-new > * { min-width: 0; }
.share-preview { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.share-preview .table { min-width: 520px; margin: 0; }
.share-opts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.share-opts .field .input { max-width: 220px; }
.checks { display: grid; gap: 8px; font-size: 12.8px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; }
.checks input { margin-top: 3px; }
.checks small { color: var(--muted); }
.qr-box { display: flex; gap: 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.qr-box img { width: 104px; height: 104px; flex: none; border: 1px solid var(--line); border-radius: 6px; }
.qr-box b { display: block; color: var(--head); font-size: 13px; }
.qr-box span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.qr-box .btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.views { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12.3px; }
.views li { display: flex; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--line); }
.views li:first-child { border-top: 0; }
.views .t { font-family: var(--mono); color: var(--head); width: 128px; flex: none; }
.views .bot { color: var(--faint); }
.share-views summary, .share-old summary { cursor: pointer; color: var(--muted); }
/* Hộp thoại chia sẻ báo giá */
.never { display: flex; flex-wrap: wrap; gap: 6px; }
.never span { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: var(--soft-2); color: #4a5563;
  text-decoration: line-through; text-decoration-color: rgba(194, 43, 43, .55); }
.stat3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.stat3 > div { padding: 10px 12px; border-left: 1px solid var(--line); min-width: 0; }
.stat3 > div:first-child { border-left: 0; }
.stat3 .k { font-size: 11px; color: var(--muted); }
.stat3 .v { font-weight: 700; color: var(--head); font-size: 15px; margin-top: 2px; }
.stat3 .s { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
/* Phản hồi của khách trên link báo giá (S3) */
.share-replies { display: grid; gap: 6px; }
.share-replies .lbl-sec { display: flex; align-items: center; gap: 8px; }
.share-replies .lbl-sec form { margin-left: auto; }
.reply { border: 1px solid #f0e2bb; background: var(--warn-bg); border-radius: var(--radius-sm); padding: 9px 12px;
  font-size: 12.5px; color: #5c4a1a; line-height: 1.55; }
.reply b { color: var(--head); }
.reply.ok { border-color: #bfe5d1; background: var(--pass-bg); color: #0e6a4b; }
.reply.new { box-shadow: inset 3px 0 0 var(--accent); }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-card { flex: 1 1 240px; display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2, var(--line));
  border-radius: var(--radius-sm); font-size: 12.8px; cursor: pointer; background: #fff; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin-top: 3px; }
.radio-card b { color: var(--head); display: block; }
.radio-card small { color: var(--muted); }
.vat-field { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 8px; }
.vat-field legend { padding: 0; margin-bottom: 6px; font-weight: 600; color: var(--head); font-size: 12.8px; }
.vat-field legend .muted { font-weight: 500; }
.vat-field .input.vat-rate { display: inline-block; width: 56px; padding: 3px 6px; font-size: 12.5px; }
.share-sum { margin: 6px 0 0; text-align: right; }
.share-sum b { color: var(--head); }
.share-fields { gap: 10px 14px; }
.share-cols { gap: 14px; }
@media (max-width: 620px) {
  .stat3 { grid-template-columns: minmax(0, 1fr); }
  .stat3 > div { border-left: 0; border-top: 1px solid var(--line); }
  .stat3 > div:first-child { border-top: 0; }
  .share-fields, .share-cols { grid-template-columns: minmax(0, 1fr); }
}
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-foot .btns { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 620px) {
  .share-opts { grid-template-columns: minmax(0, 1fr); }
  .qr-box { align-items: flex-start; }
  .qr-box img { width: 84px; height: 84px; }
  .views .t { width: 104px; }
}

/* Quản trị → Link chia sẻ */
.admin-shares small.block { display: block; }
.admin-shares .muted-row td { color: var(--muted); }
.admin-shares .muted-row { background: var(--soft); }
.admin-shares .actions-cell { white-space: nowrap; text-align: right; }
.admin-shares .actions-cell .inline-form { display: inline-block; margin: 0 0 0 4px; }
/* Nguồn cho nút "Sao chép" khi không muốn hiện ô link (vẫn select được cho execCommand). */
.copy-src { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* ── Bước 2 của đăng nhập (mã TOTP) ─────────────────────────────────────────────────────── */
.login-steps { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.login-steps b { color: var(--accent); }
.login-steps i { width: 22px; height: 1px; background: var(--line); }
.login-code { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: .28em; text-align: center; }
.login-recovery summary { cursor: pointer; font-size: 12px; color: var(--info); }
.login-recovery[open] summary { margin-bottom: 10px; }
.login-other { margin-top: 12px; }
.login-link { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--info); cursor: pointer; }
.login-link:hover { text-decoration: underline; }
.login-alert-ok { background: var(--pass-bg); border-color: #c6e9d8; color: var(--pass); }
.login-box-wide { max-width: 440px; }
.twofa-setup { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; margin: 4px 0 16px; }
.twofa-setup ol { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 12.6px; color: var(--text); }
.twofa-qr { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.twofa-qr svg { display: block; width: 100%; height: 100%; }
.twofa-secret { display: inline-block; margin-top: 2px; padding: 2px 6px; border-radius: 6px; background: var(--soft);
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em; word-break: break-all; }
.twofa-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0 0 14px; }
.twofa-codes span { padding: 7px 8px; border: 1px dashed var(--line); border-radius: 8px; text-align: center;
  font-size: 13.5px; font-weight: 700; color: var(--head); letter-spacing: .06em; background: #fff; }
@media (max-width: 560px) { .twofa-setup { grid-template-columns: minmax(0, 1fr); } .twofa-qr { margin: 0 auto; } }
@media print { .login-hero, .login-submit, .login-alert { display: none; } .login-shell { display: block; } }
.login-hero .login-brand { color: #fff; font-weight: 800; letter-spacing: .01em; text-decoration: none; }
.login-hero .login-brand span { color: var(--accent-light); }

/* Số đếm trên menu (Hàng chờ). */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 10.5px; font-weight: 700; }
.chip-info { background: var(--info-soft); border-color: #cfe0f3; color: #1f5c99; }
.chip-na { background: #f4f6f9; color: var(--muted); }
