/* Design tokens VitroLab (docs/ui.md §2). Muốn đổi giao diện chỉ sửa file này. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter-vietnamese-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  /* Thương hiệu & nền */
  --vl-brand: #0f6b5f;
  --vl-brand-hover: #0a564c;
  --vl-brand-soft: #e3f1ed;     /* nền mục menu đang chọn, avatar */
  --vl-brand-ink: #0b5a50;      /* chữ trên nền brand-soft */
  --vl-bg: #f4f6f5;             /* nền trang */
  --vl-surface: #ffffff;        /* card, sidebar, header */
  --vl-surface-alt: #f8faf9;    /* đầu bảng, hover dòng */
  --vl-border: #dfe5e3;
  --vl-border-soft: #edf1ef;    /* đường kẻ trong card/bảng */
  --vl-input-border: #cfd8d5;

  /* Chữ */
  --vl-text: #1c2826;
  --vl-text-2: #3d4c48;
  --vl-muted: #56645f;          /* chú thích; đạt tương phản 4.5:1 trên nền trắng */

  /* Trạng thái — nền / chữ */
  --vl-ok-bg: #dcfce7;    --vl-ok: #166534;     /* đang nuôi, đã in */
  --vl-warn-bg: #fef3c7;  --vl-warn: #854d0e;   /* cảnh báo vàng: cho phép tiếp tục */
  --vl-block-bg: #fee2e2; --vl-block: #991b1b;  /* chặn đỏ / cách ly */
  --vl-pend-bg: #e0e7ff;  --vl-pend: #3730a3;   /* chờ xác nhận (tự khai) */
  --vl-mut-bg: #eef1f0;   --vl-mut: #4b5a56;    /* hoàn tất, đã hủy, trung tính */

  /* Stage — nền / chữ / màu thanh biểu đồ */
  --vl-stage-k-bg: #ede9fe; --vl-stage-k: #5b21b6; --vl-stage-k-bar: #6d28d9;
  --vl-stage-n-bg: #dcfce7; --vl-stage-n: #166534; --vl-stage-n-bar: #15803d;
  --vl-stage-r-bg: #ffedd5; --vl-stage-r: #9a3412; --vl-stage-r-bar: #c2410c;
  --vl-stage-h-bg: #dbeafe; --vl-stage-h: #1e40af; --vl-stage-h-bar: #1d4ed8;
  --vl-stage-x-bg: #e2e8f0; --vl-stage-x: #334155; --vl-stage-x-bar: #475569;

  /* Sandbox */
  --vl-sandbox-bg: #fef3c7;
  --vl-sandbox-border: #f2d27a;
  --vl-sandbox-ink: #713f12;
  --vl-sandbox-dot: #d97706;
  --vl-sandbox-switcher-bg: #fffbeb;

  /* Hình khối & chữ */
  --vl-radius: 8px;        /* nút, input */
  --vl-radius-lg: 12px;    /* card */
  --vl-font: 'Inter', system-ui, sans-serif;
  --vl-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --vl-fs: 14px;           /* chữ thân */
  --vl-fs-sm: 13px;
  --vl-fs-xs: 12px;        /* badge, nhãn form, đầu bảng */
  --vl-h1: 24px;
  --vl-h2: 16px;
  --vl-control-h: 38px;    /* chiều cao input/nút */
  --vl-control-h-sm: 32px;

  /* Ánh xạ sang Tabler/Bootstrap */
  --tblr-primary: var(--vl-brand);
  --tblr-primary-rgb: 15, 107, 95;
  --tblr-primary-darken: var(--vl-brand-hover);
  --tblr-font-sans-serif: var(--vl-font);
  --tblr-font-monospace: var(--vl-mono);
  --tblr-body-font-size: var(--vl-fs);
  --tblr-body-bg: var(--vl-bg);
  --tblr-body-color: var(--vl-text);
  --tblr-secondary-color: var(--vl-muted);
  --tblr-bg-surface: var(--vl-surface);
  --tblr-border-color: var(--vl-border);
  --tblr-border-radius: var(--vl-radius);
  --tblr-border-radius-lg: var(--vl-radius-lg);
  --tblr-link-color: var(--vl-brand);
  --tblr-link-hover-color: var(--vl-brand-hover);
}

body {
  background: var(--vl-bg);
  color: var(--vl-text);
  font-family: var(--vl-font);
  font-size: var(--vl-fs);
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.num { font-variant-numeric: tabular-nums; text-align: right; }
.mono { font-family: var(--vl-mono); }
.text-muted { color: var(--vl-muted) !important; }

.form-control, .form-select { border-color: var(--vl-input-border); min-height: var(--vl-control-h); }
.form-label { font-size: var(--vl-fs-xs); }
.btn { min-height: var(--vl-control-h); border-radius: var(--vl-radius); }

/* Bố cục base_app.html (docs/ui.md §3) */
.vl-sandbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 8px 32px;
  background: var(--vl-sandbox-bg);
  border-bottom: 1px solid var(--vl-sandbox-border);
  color: var(--vl-sandbox-ink);
  font-size: var(--vl-fs-sm);
}
.vl-sandbox-text { flex: 1 1 320px; }
.vl-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--vl-sandbox-dot);
}

.vl-shell { display: flex; flex-wrap: wrap; align-items: stretch; min-height: 100%; }
.vl-sidebar {
  flex: 1 1 240px;
  max-width: 100%;
  padding: 16px 12px;
  background: var(--vl-surface);
  border-right: 1px solid var(--vl-border);
}
.vl-main { flex: 999 1 560px; min-width: 0; }

.vl-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  color: var(--vl-text);
  font-size: 17px;
  font-weight: 700;
}
.vl-logo-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--vl-radius);
  background: var(--vl-brand);
  color: var(--vl-surface);
}

.vl-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--vl-border);
  border-radius: var(--vl-radius);
  background: var(--vl-surface);
  color: var(--vl-text);
  text-decoration: none;
}
.vl-switcher:hover { background: var(--vl-surface-alt); color: var(--vl-text); text-decoration: none; }
.vl-switcher-sandbox { border-color: var(--vl-sandbox-dot); background: var(--vl-sandbox-switcher-bg); }
.vl-switcher-text { flex: 1; min-width: 0; }
.vl-switcher-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl-view-as { margin: -8px 0 16px; }
.vl-switcher-role { display: block; color: var(--vl-muted); font-size: var(--vl-fs-xs); }

.vl-menu-group {
  margin: 16px 8px 6px;
  color: var(--vl-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.vl-menu { list-style: none; margin: 0; padding: 0; }
.vl-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--vl-radius);
  color: var(--vl-text-2);
  text-decoration: none;
}
.vl-menu a:hover { background: var(--vl-surface-alt); color: var(--vl-text); }
.vl-menu a[aria-current="page"] { background: var(--vl-brand-soft); color: var(--vl-brand-ink); font-weight: 600; }

.vl-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 12px 32px;
  background: var(--vl-surface);
  border-bottom: 1px solid var(--vl-border);
  color: var(--vl-text-2);
  font-size: var(--vl-fs-sm);
}
.vl-search { position: relative; flex: 1 1 240px; max-width: 440px; margin-right: auto; }
.vl-search > svg { z-index: 6; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--vl-muted); }
.vl-search .form-control { padding-left: 36px; }
.vl-user { display: flex; align-items: center; gap: 8px; }
.vl-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--vl-brand-soft);
  color: var(--vl-brand-ink);
  font-weight: 600;
  text-transform: uppercase;
}

.vl-content { padding: 24px 32px; }
.vl-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.vl-page-head > div:first-child { flex: 1 1 auto; }
.vl-page-head h1 { margin: 0; font-size: var(--vl-h1); font-weight: 700; }
.vl-page-head p { margin: 4px 0 0; color: var(--vl-muted); }

/* Trang ngoài lab: đăng nhập, chọn lab */
.vl-center { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.vl-center > * { width: 100%; max-width: 420px; }

/* Component (docs/ui.md §4) */
.vl-card {
  margin-bottom: 20px;
  background: var(--vl-surface);
  border: 1px solid var(--vl-border);
  border-radius: var(--vl-radius-lg);
}
.vl-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--vl-border-soft);
}
.vl-card-head h2 { flex: 1; margin: 0; font-size: var(--vl-h2); font-weight: 700; }
.vl-card-body { padding: 18px; }

.vl-stat { padding: 18px; }
.vl-stat-label { color: var(--vl-muted); font-size: var(--vl-fs-sm); }
.vl-stat-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.vl-stat-note { font-size: var(--vl-fs-sm); color: var(--vl-muted); }
.vl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.vl-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--vl-fs-xs);
  font-weight: 600;
}
.vl-badge-ok { background: var(--vl-ok-bg); color: var(--vl-ok); }
.vl-badge-warn { background: var(--vl-warn-bg); color: var(--vl-warn); }
.vl-badge-block { background: var(--vl-block-bg); color: var(--vl-block); }
.vl-badge-pend { background: var(--vl-pend-bg); color: var(--vl-pend); }
.vl-badge-mut { background: var(--vl-mut-bg); color: var(--vl-mut); }

.vl-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--vl-radius);
}
.vl-alert-warn { background: var(--vl-warn-bg); color: var(--vl-warn); }
.vl-alert-block { background: var(--vl-block-bg); color: var(--vl-block); }
.vl-alert-info { background: var(--vl-pend-bg); color: var(--vl-pend); }

.vl-stage {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  font-family: var(--vl-mono);
  font-size: var(--vl-fs-xs);
  font-weight: 700;
}
.vl-stage-k { background: var(--vl-stage-k-bg); color: var(--vl-stage-k); }
.vl-stage-n { background: var(--vl-stage-n-bg); color: var(--vl-stage-n); }
.vl-stage-r { background: var(--vl-stage-r-bg); color: var(--vl-stage-r); }
.vl-stage-h { background: var(--vl-stage-h-bg); color: var(--vl-stage-h); }
.vl-stage-x { background: var(--vl-stage-x-bg); color: var(--vl-stage-x); }

.vl-filter { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; padding: 14px 18px; }
.vl-filter .mb-3 { margin-bottom: 0 !important; }
.vl-filter-actions { display: flex; gap: 8px; margin-left: auto; }
.vl-chips { display: flex; gap: 6px; }
.vl-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--vl-border);
  border-radius: 999px;
  font-family: var(--vl-mono);
  font-weight: 700;
  cursor: pointer;
}
.btn-check:checked + .vl-chip { background: var(--vl-brand); border-color: var(--vl-brand); color: var(--vl-surface); }
.btn-check:focus-visible + .vl-chip { outline: 2px solid var(--vl-brand); outline-offset: 2px; }

.vl-table td { white-space: nowrap; }
.vl-row-voided td:not(:last-child) { text-decoration: line-through; color: var(--vl-muted); }
.vl-pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; color: var(--vl-muted); }
.vl-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
@media print {
  .vl-sidebar, .vl-header, .vl-sandbox, .vl-noprint { display: none !important; }
  .vl-content { padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
  .table-responsive { overflow: visible; }
  .vl-print-wide { page: wide; }
}
@page wide { size: A4 landscape; }
.vl-intake-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 16px; }
.vl-intake-grid .mb-3 { margin-bottom: 0 !important; }
.vl-hint { display: block; min-height: 1.5em; margin-bottom: 12px; color: var(--vl-muted); }
.form-control.vl-count { border: 2px solid var(--vl-brand); font-weight: 700; }
.form-control.vl-count:focus { box-shadow: 0 0 0 3px var(--vl-brand-soft); }
.vl-intake-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.vl-intake-foot > div:first-child { flex: 1 1 auto; color: var(--vl-muted); }
.vl-intake-code { margin-left: 8px; font-size: 18px; font-weight: 700; color: var(--vl-text); }
.vl-label { position: relative; background: var(--vl-surface); color: var(--vl-text); outline: 1px solid var(--vl-border); }
.vl-label-box { position: absolute; display: flex; align-items: center; white-space: nowrap; overflow: hidden; line-height: 1; }
.vl-label-box svg path { fill: currentColor; }
.vl-label-code { font-family: var(--vl-mono); font-weight: 700; }
.vl-intake-row { display: flex; flex-wrap: wrap; gap: 0 16px; }
.vl-intake-row > :first-child { flex: 999 1 560px; min-width: 0; }
.vl-intake-row > :last-child { flex: 1 1 300px; }
.vl-pending-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--vl-border-soft); }
.vl-pending-row:first-child { border-top: 0; padding-top: 0; }
.vl-print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; }
.vl-label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 16px; }
/* Ô khổ tùy chỉnh chỉ hiện khi chọn Tùy chỉnh; ô tờ A4 khi chọn Tờ A4. */
.vl-label-custom, .vl-label-sheet { display: none; }
form:has([name="size"][value="custom"]:checked) .vl-label-custom { display: block; }
form:has([name="custom_kind"][value="sheet"]:checked) .vl-label-sheet { display: block; }

/* floor: điện thoại một cột, vùng chạm 44px (docs/ui.md §7) */
.vl-floor { max-width: 480px; margin: 0 auto; padding: 0 16px 24px; }
.vl-floor-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.vl-floor-header .vl-logo { padding: 0; text-decoration: none; }
.vl-floor h1 { margin: 8px 0 16px; font-size: var(--vl-h1); font-weight: 700; }
.vl-floor .form-control, .vl-floor .btn { min-height: 44px; }
.vl-floor-code { margin: 0 0 8px; font-size: 28px; font-weight: 700; overflow-wrap: anywhere; }
.vl-floor-list { list-style: none; margin: 0; padding: 0; }
.vl-floor-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--vl-border-soft); }
.vl-floor-list li:last-child { border-bottom: 0; }

/* site: landing vitrolab.vn (docs/ui.md §8) */
.vl-site { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.vl-site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; }
.vl-site-header .vl-logo { padding: 0; text-decoration: none; }
.vl-site-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px 16px; }
.vl-site-news { max-width: 720px; padding: 24px 0 40px; }
.vl-site-news h1 { margin: 0 0 16px; font-size: 28px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.vl-site-news time { display: block; margin-bottom: 12px; color: var(--vl-muted); }
.vl-site-news-item { padding: 16px 0; border-top: 1px solid var(--vl-border-soft); }
.vl-site-news-item h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.vl-site-news-item p { margin: 0; color: var(--vl-text-2); }
.vl-site-contact { max-width: 560px; padding: 24px 0 40px; }
.vl-site-contact h1 { margin: 0 0 16px; font-size: 28px; font-weight: 700; line-height: 1.25; }
.vl-site-contact #div_id_website { position: absolute; left: -9999px; }
.vl-site-hero { padding: 48px 0 40px; }
.vl-site-hero h1 { margin: 0 0 16px; font-size: 36px; font-weight: 700; line-height: 1.2; }
.vl-site-hero p { max-width: 640px; margin: 0 0 24px; color: var(--vl-text-2); font-size: 17px; }
.vl-site-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding-bottom: 40px; }
.vl-site-feature { padding: 18px; border: 1px solid var(--vl-border); border-radius: var(--vl-radius); background: var(--vl-surface); }
.vl-site-feature .icon { color: var(--vl-brand); }
.vl-site-feature h2 { margin: 8px 0; font-size: 16px; font-weight: 700; }
.vl-site-feature p { margin: 0; color: var(--vl-muted); }
.vl-site-footer { padding: 16px 0 24px; border-top: 1px solid var(--vl-border-soft); color: var(--vl-muted); }

/* Quét QR bằng camera (components/scan.html, static/js/scan.js). */
.vl-scan-dialog { width: min(480px, calc(100vw - 32px)); padding: 16px; border: 0; border-radius: 12px; }
.vl-scan-dialog::backdrop { background: rgb(0 0 0 / 0.6); }
.vl-scan-dialog video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #000; }
.vl-scan-msg { margin: 12px 0; color: var(--vl-muted); }
