/* ============================================================
   QLĐH CAO TẦNG — Giao diện quản lý điều hành thi công
   ============================================================ */

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --navy: #0d1929;
  --navy-2: #142338;
  --navy-3: #1d3049;
  --ink: #142033;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e4e9f1;
  --line-2: #eef2f7;
  --brand: #f59e0b;
  --brand-dark: #b45309;
  --brand-soft: #fff7e6;
  --blue: #2563eb;
  --blue-soft: #eff5ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --cyan: #0e7490;
  --cyan-soft: #ecfeff;
  --orange: #ea580c;
  --orange-soft: #fff7ed;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .05);
  --shadow: 0 8px 24px -12px rgba(15, 27, 45, .18);
  --shadow-lg: 0 30px 60px -20px rgba(15, 27, 45, .35);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 270px;
  --font: "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
::selection { background: #fde68a; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd8e5; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #aab7c9; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- Layout ---------------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(245, 158, 11, .13), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, #0a1422 100%);
  color: #dbe4f0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.content {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px 28px 48px;
  flex: 1;
}

/* ---------------- Sidebar ---------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
}
.brand-mark {
  width: 58px;
  height: 46px;
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  padding: 5px 6px;
  box-shadow: 0 8px 18px -8px rgba(2, 10, 25, .6);
  flex: none;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-copy { min-width: 0; }
.brand-name { font-weight: 800; letter-spacing: .1em; font-size: 14px; color: #fff; line-height: 1.25; }
.brand-sub { font-size: 10.5px; color: #8fa0b8; letter-spacing: .01em; line-height: 1.35; }
.sidebar .sidebar-close { display: none; margin-left: auto; color: #9fb0c7; }

.project-card {
  margin: 4px 16px 18px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
}
.project-card .pc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.project-card .pc-code {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #fcd34d;
  background: rgba(245, 158, 11, .14);
  border: 1px solid rgba(245, 158, 11, .3);
  padding: 2px 7px;
  border-radius: 5px;
}
.project-card .pc-name { font-size: 13px; font-weight: 650; color: #fff; line-height: 1.35; }
.project-card .pc-meta { font-size: 11px; color: #91a2ba; margin-top: 4px; }
.project-card .pc-progress { margin-top: 11px; }
.project-card .pc-progress-top {
  display: flex; justify-content: space-between; font-size: 10.5px; color: #9fb0c7; margin-bottom: 5px;
}
.project-card .pc-progress-top b { color: #fbbf24; font-size: 11px; }

.nav { padding: 0 12px 12px; overflow-y: auto; flex: 1; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border: none; }
.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  color: #5f728c;
  padding: 16px 12px 7px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #aebcd0;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(245, 158, 11, .17), rgba(245, 158, 11, .05));
  color: #fff;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.nav-item.active svg { color: var(--brand); opacity: 1; }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: 99px;
  background: rgba(220, 38, 38, .18);
  color: #fca5a5;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.nav-item.active .nav-badge { background: var(--brand); color: #271807; }
.nav-badge.soon {
  background: rgba(255, 255, 255, .07);
  color: #7d90a9;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: .03em;
}
.project-card .progress { background: rgba(255, 255, 255, .12); }

.sidebar-foot {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 11px;
  color: #7287a1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .15);
}
.sidebar-foot .version { margin-left: auto; color: #52667f; }

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(9, 16, 27, .55);
  backdrop-filter: blur(2px);
  z-index: 35;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s;
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(243, 245, 249, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title h1 { font-size: 20px; font-weight: 750; letter-spacing: -.015em; }
.topbar-title p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.motto-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 9px 20px;
  background:
    radial-gradient(120% 200% at 50% 0%, rgba(245, 158, 11, .2), transparent 62%),
    linear-gradient(90deg, #0d1929 0%, #182b43 50%, #0d1929 100%);
  border-bottom: 1px solid rgba(245, 158, 11, .3);
  color: #fcd34d;
  font-size: 15px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: .05em;
  line-height: 1.35;
  text-align: center;
}
.motto-bar::before,
.motto-bar::after {
  content: "";
  width: 54px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, .7));
  flex: none;
}
.motto-bar::after { transform: scaleX(-1); }
.motto-bar-text { min-width: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tower-select {
  max-width: 158px;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: #e6d7b4;
}
@media (max-width: 900px) { .tower-select { max-width: 118px; } }
@media (max-width: 620px) { .tower-select { max-width: 100px; font-size: 11px; padding: 6px 7px; } }
.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 7px 11px;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.date-chip::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
}
.icon-btn.menu-btn { display: none; }
.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: background .15s;
  flex: none;
}
.icon-btn:hover { background: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--ink-2);
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  text-decoration: none;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  color: #2b1a05;
  box-shadow: 0 4px 12px -4px rgba(245, 158, 11, .55);
}
.btn-primary:hover { background: linear-gradient(180deg, #fcd34d, #f59e0b); }
.btn-dark { background: var(--navy-2); color: #fff; }
.btn-dark:hover { background: var(--navy-3); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: #cfd8e5; }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn {
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px;
}
.link-btn:hover { text-decoration: underline; }
.row-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.row-actions .icon-btn { width: 29px; height: 29px; color: var(--muted); }
.row-actions .icon-btn:hover { background: var(--line-2); color: var(--ink); }
.row-actions .icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

/* ---------------- Cards & headings ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 17px 20px 13px;
  border-bottom: 1px solid var(--line-2);
}
.card-head.no-border { border-bottom: 0; padding-bottom: 4px; }
.card-head h2 { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-head .head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px 20px 20px; }
.card-body.tight { padding: 6px 10px 12px; }

.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head .ph-text h2 { font-size: 17px; font-weight: 750; }
.page-head .ph-text p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.page-head .ph-logo {
  flex: none;
  width: 56px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 3px 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}
.page-head .ph-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.page-head .ph-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------- KPI ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 13px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--kpi-tint, var(--brand-soft));
  opacity: .55;
}
.kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; position: relative; z-index: 1; }
.kpi-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--kpi-tint, var(--brand-soft));
  color: var(--kpi-color, var(--brand-dark));
  display: grid; place-items: center; flex: none;
}
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-label { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.kpi-value {
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -.03em;
  line-height: 1.15;
  position: relative;
  z-index: 1;
}
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.kpi-meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 5px; position: relative; z-index: 1; }
.kpi-meta .up { color: var(--green); font-weight: 600; }
.kpi-meta .warn { color: var(--orange); font-weight: 600; }
.kpi-meta .bad { color: var(--red); font-weight: 600; }
.kpi-progress { margin-top: 10px; }

/* ---------------- Module cards ---------------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.module-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.module-card:hover {
  border-color: #cbd7e6;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.mc-ico {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; flex: none;
}
.mc-ico svg { width: 19px; height: 19px; }
.mc-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mc-main b { font-size: 13px; font-weight: 700; color: var(--ink); }
.mc-main span { font-size: 11.5px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mc-arrow { margin-left: auto; color: #b6c3d3; flex: none; display: grid; place-items: center; }
.mc-arrow svg { width: 16px; height: 16px; }

/* ---------------- Grids ---------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-18 { margin-bottom: 18px; }
.mt-16 { margin-top: 16px; }

/* ---------------- Progress & bars ---------------- */
.progress {
  height: 7px;
  background: #edf1f7;
  border-radius: 99px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  transition: width .4s ease;
}
.progress.green > span { background: linear-gradient(90deg, #34d399, #059669); }
.progress.blue > span { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.progress.red > span { background: linear-gradient(90deg, #f87171, #dc2626); }
.progress.thin { height: 5px; }

.bar-list { display: flex; flex-direction: column; gap: 15px; }
.bar-row .bar-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.bar-row .bar-name { font-weight: 600; color: var(--ink-2); }
.bar-row .bar-count { font-size: 11px; color: var(--muted-2); }
.bar-row .bar-val { margin-left: auto; font-weight: 700; font-size: 12.5px; }

/* ---------------- Donut ---------------- */
.donut-wrap { display: flex; align-items: center; gap: 22px; padding: 6px 0; flex-wrap: wrap; }
.donut {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  position: relative;
  flex: none;
  background: conic-gradient(var(--seg1) 0 var(--p1), var(--seg2) var(--p1) var(--p2), var(--seg3) var(--p2) var(--p3), var(--seg4) var(--p3) 100%);
  box-shadow: inset 0 0 0 1px rgba(15,27,45,.04);
}
.donut::after {
  content: "";
  position: absolute;
  inset: 17px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line-2);
}
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  z-index: 1;
}
.donut-center b { font-size: 23px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.donut-center span { font-size: 10.5px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 9px; font-size: 12.5px; flex: 1; min-width: 130px; }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-row .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-row .lg-label { color: var(--muted); }
.legend-row .lg-val { margin-left: auto; font-weight: 700; }

/* ---------------- Chips / badges ---------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.4;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.chip.no-dot::before { display: none; }
.chip-green { background: var(--green-soft); color: #047857; border-color: #d1fae5; }
.chip-blue { background: var(--blue-soft); color: #1d4ed8; border-color: #dbeafe; }
.chip-amber { background: var(--brand-soft); color: var(--brand-dark); border-color: #fde68a; }
.chip-red { background: var(--red-soft); color: #b91c1c; border-color: #fecaca; }
.chip-violet { background: var(--violet-soft); color: #6d28d9; border-color: #ede9fe; }
.chip-cyan { background: var(--cyan-soft); color: #0e7490; border-color: #cffafe; }
.chip-gray { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.chip-gray { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.chip-orange { background: var(--orange-soft); color: #c2410c; border-color: #fed7aa; }
.chip-hold { background: #fffbeb; color: #92400e; border-color: #fde68a; font-size: 10.5px; }
.chip-hold::before { background: #d97706; }

/* ---------------- Tables ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.tbl th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fbfcfe; }
.tbl .cell-title { font-weight: 600; color: var(--ink); }
.tbl .cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions-col { width: 1%; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.tbl tfoot td { background: #fafbfd; font-weight: 600; font-size: 12px; }
.table-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-top: 1px solid var(--line-2);
  font-size: 11.5px;
  color: var(--muted);
}
.table-foot .foot-right { margin-left: auto; }
.price-input {
  width: 140px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 12.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.price-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cell-progress { display: flex; align-items: center; gap: 9px; min-width: 118px; }
.cell-progress .progress { width: 66px; flex: none; }
.cell-progress b { font-size: 11.5px; min-width: 30px; text-align: right; }

.code-tag {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  white-space: nowrap;
}

/* ---------------- Alert / list items ---------------- */
.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex;
  gap: 11px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-2);
  align-items: flex-start;
}
.alert-item:last-child { border-bottom: 0; }
.alert-ico {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; flex: none;
  background: var(--blue-soft); color: var(--blue);
}
.alert-ico svg { width: 15px; height: 15px; }
.alert-ico.warn { background: var(--orange-soft); color: var(--orange); }
.alert-ico.bad { background: var(--red-soft); color: var(--red); }
.alert-ico.ok { background: var(--green-soft); color: var(--green); }
.alert-main { min-width: 0; flex: 1; }
.alert-title { font-size: 12.8px; font-weight: 600; line-height: 1.35; }
.alert-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.alert-right { font-size: 11px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.alert-list .empty-inline { padding: 22px 20px; color: var(--muted); font-size: 12.5px; }

/* ---------------- Filter bar ---------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.filter-bar .filter-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.filter-bar .spacer { flex: 1; }
.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  min-width: 230px;
  flex: 1;
  max-width: 340px;
  color: var(--muted);
}
.search-box svg { width: 15px; height: 15px; flex: none; }
.search-box input { border: 0; background: transparent; outline: none; padding: 8px 0; width: 100%; font-size: 12.5px; }
.filter-select {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  outline: none;
  cursor: pointer;
  max-width: 190px;
}
.filter-select:focus { border-color: #c9b27a; }
.pill-tabs { display: inline-flex; gap: 3px; background: #eef2f7; padding: 3px; border-radius: 9px; }
.pill-tab {
  border: 0;
  background: transparent;
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.pill-tab:hover { color: var(--ink); }
.pill-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.pill-tab .count { color: var(--muted-2); font-size: 10.5px; margin-left: 3px; }

/* ---------------- Empty state ---------------- */
.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
}
.empty-ico {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  margin: 0 auto 12px;
  color: var(--muted-2);
}
.empty-ico svg { width: 22px; height: 22px; }
.empty h3 { font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 360px; margin: 0 auto; }

/* ---------------- Section / mini stat ---------------- */
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.mini-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mini-stat .ms-ico {
  width: 33px; height: 33px; border-radius: 9px; display: grid; place-items: center;
  background: var(--ms-tint, var(--surface-2)); color: var(--ms-color, var(--muted)); flex: none;
}
.mini-stat .ms-ico svg { width: 16px; height: 16px; }
.mini-stat b { font-size: 18px; font-weight: 750; letter-spacing: -.02em; display: block; line-height: 1.1; }
.mini-stat span { font-size: 11px; color: var(--muted); }
.mini-stat small { font-weight: 600; font-size: 10.5px; color: var(--muted); }

.section-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin: 22px 0 10px; }
.section-title .st-line { flex: 1; height: 1px; background: var(--line); }
.section-title .st-count { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ---------------- Forms ---------------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.field > label .req { color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 9px 11px;
  outline: none;
  font-size: 13px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 74px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #e3b45f;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .13);
}
.field .hint { font-size: 10.5px; color: var(--muted-2); }
.check-field { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 500; padding-top: 20px; }
.check-field input { width: 16px; height: 16px; accent-color: var(--brand-dark); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid-3 .full { grid-column: 1 / -1; }

/* ---------------- Modal ---------------- */
#modal-root { position: relative; z-index: 700; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 16, 27, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 18px 30px;
  overflow-y: auto;
  animation: fadeIn .15s ease;
  z-index: 100;
}
.modal {
  width: 640px;
  max-width: 100%;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s cubic-bezier(.2, .8, .3, 1);
  margin-bottom: 20px;
}
.modal.wide { width: 920px; }
.modal.narrow { width: 440px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.modal-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-head .modal-x { margin-left: auto; flex: none; }
.modal-body { padding: 20px 22px; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line-2);
}
.modal-foot .foot-note { margin-right: auto; font-size: 11px; color: var(--muted); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } }

/* ---------------- Toast ---------------- */
.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--navy-2);
  color: #f1f5f9;
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 16px 38px -12px rgba(8, 15, 26, .6);
  animation: toastIn .2s ease;
  max-width: 380px;
  pointer-events: auto;
}
.toast svg { width: 16px; height: 16px; flex: none; color: #34d399; }
.toast.error svg { color: #f87171; }
.toast.warn svg { color: #fbbf24; }
.toast.hide { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------------- Dashboard extras ---------------- */
.urgent-list { display: flex; flex-direction: column; }
.urgent-item {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 11px 20px;
  border-bottom: 1px solid var(--line-2);
}
.urgent-item:last-child { border-bottom: 0; }
.urgent-item .ui-days {
  width: 46px;
  flex: none;
  text-align: center;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 5px 0 4px;
}
.urgent-item .ui-days b { display: block; font-size: 15px; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; }
.urgent-item .ui-days span { font-size: 9px; color: var(--muted); display: block; text-transform: uppercase; letter-spacing: .04em; }
.urgent-item .ui-days.late { background: var(--red-soft); border-color: #fecaca; color: var(--red); }
.urgent-item .ui-days.soon { background: var(--brand-soft); border-color: #fde68a; color: var(--brand-dark); }
.urgent-item .ui-main { flex: 1; min-width: 0; }
.urgent-item .ui-title { font-size: 12.8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.urgent-item .ui-sub { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.urgent-item .ui-pct { font-size: 12px; font-weight: 700; flex: none; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, transform .1s;
}
.quick-btn:hover { border-color: #e2c07a; background: #fffdf8; }
.quick-btn:active { transform: translateY(1px); }
.quick-btn .qb-ico {
  width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark);
}
.quick-btn .qb-ico svg { width: 15px; height: 15px; }
.quick-btn b { font-size: 12.3px; font-weight: 650; }
.quick-btn span { font-size: 10.5px; color: var(--muted); }

.safety-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.safety-stat {
  flex: 1;
  min-width: 90px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
}
.safety-stat b { font-size: 19px; display: block; line-height: 1.15; letter-spacing: -.02em; }
.safety-stat span { font-size: 10.5px; color: var(--muted); }
.safety-stat.bad b { color: var(--red); }
.safety-stat.warn b { color: var(--orange); }
.safety-stat.ok b { color: var(--green); }

/* ---------------- Detail list (settings/report) ---------------- */
.kv-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

.settings-section + .settings-section { margin-top: 18px; }
.settings-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.data-note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--blue-soft);
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 12px;
  line-height: 1.5;
}
.data-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.data-note.warn { background: var(--brand-soft); border-color: #fde68a; color: #92400e; }
.data-note.danger { background: var(--red-soft); border-color: #fecaca; color: #991b1b; }

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.feature-list li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 12.8px;
  color: var(--ink-2);
}
.feature-list svg { width: 16px; height: 16px; color: var(--green); flex: none; margin-top: 1px; }

/* ---------------- Search empty & misc ---------------- */
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.text-muted { color: var(--muted); }
.text-small { font-size: 11.5px; }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); display: inline-block; }

/* ---------------- Print ---------------- */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 14mm 13mm; }
  body { background: #fff; font-size: 12px; }
  .app-shell, .toast-root, #modal-root, #import-file { display: none !important; }
  #print-area { display: block !important; }
  .print-doc { font-family: "Times New Roman", Times, serif; color: #111; }
  .print-doc .p-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1.5px solid #111; padding-bottom: 10px; margin-bottom: 16px; }
  .print-doc .p-company { font-size: 11px; text-transform: uppercase; }
  .print-doc .p-company b { display: block; font-size: 12.5px; }
  .print-doc .p-title { text-align: center; margin: 12px 0 4px; }
  .print-doc .p-title h2 { font-size: 18px; text-transform: uppercase; margin: 0; letter-spacing: .02em; }
  .print-doc .p-title p { font-size: 12px; margin: 3px 0 0; }
  .print-doc h3 { font-size: 13px; margin: 16px 0 6px; text-transform: uppercase; }
  .print-doc table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
  .print-doc th, .print-doc td { border: 1px solid #444; padding: 5px 6px; vertical-align: top; }
  .print-doc th { background: #f1f1f1; font-weight: bold; text-align: left; }
  .print-doc .p-sign { display: flex; justify-content: space-around; margin-top: 34px; text-align: center; font-size: 12px; }
  .print-doc .p-sign > div { width: 30%; }
  .print-doc .p-sign .sign-space { height: 62px; }
  .print-doc .p-meta { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 11.5px; margin: 10px 0; }
  .print-doc .p-foot { margin-top: 22px; font-size: 10px; color: #555; border-top: 1px solid #999; padding-top: 6px; }
  .print-doc .p-kpis { display: flex; gap: 10px; margin: 10px 0; }
  .print-doc .p-kpis div { flex: 1; border: 1px solid #777; padding: 6px 8px; }
  .print-doc .p-kpis b { display: block; font-size: 15px; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1440px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1100px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.35); }
  .sidebar.open ~ .sidebar-scrim { opacity: 1; visibility: visible; }
  .sidebar .sidebar-close { display: grid; }
  .main { margin-left: 0; }
  .icon-btn.menu-btn { display: grid; }
  .content { padding: 20px 20px 44px; }
  .topbar { padding: 12px 20px; }
}
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .topbar-right .date-chip { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 11px 14px; gap: 10px; }
  .topbar-title h1 { font-size: 17px; }
  .topbar-title p { font-size: 11px; }
  .motto-bar { font-size: 12px; letter-spacing: .02em; gap: 9px; padding: 7px 12px; }
  .motto-bar::before, .motto-bar::after { width: 18px; }
  .page-head .ph-logo { width: 46px; height: 35px; border-radius: 8px; padding: 2px 4px; }
  .topbar-right .btn span:not(#backup-icon) { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .module-grid { grid-template-columns: 1fr; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 21px; }
  .kpi-label { font-size: 10.5px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { border-radius: 14px; }
  .page-head .ph-actions { width: 100%; margin-left: 0; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .date-chip { display: none; }
  .btn .btn-label-sm { display: none; }
}

/* ============================================================
   KHO – QUÉT CHỨNG TỪ / BÁO CÁO NXT
   ============================================================ */
.qaqc-tabs .pill-tabs { flex-wrap: wrap; }
.wh-steps {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}
.wh-steps span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 10px;
  white-space: nowrap;
}
.wh-steps span.on { background: var(--brand-soft); border-color: #fde68a; color: var(--brand-dark); font-weight: 700; }
.wh-steps span.done { background: var(--green-soft); border-color: #d1fae5; color: #047857; }
.wh-steps i { font-style: normal; color: var(--muted-2); }
.wh-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 28px 18px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: #fafcff;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.wh-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.wh-drop svg { width: 30px; height: 30px; color: var(--brand-dark); }
.wh-drop b { font-size: 13.5px; color: var(--ink); }
.wh-drop span { font-size: 11.5px; color: var(--muted); }
.wh-preview { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.wh-preview img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.wh-file-info {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink);
}
.wh-file-info svg { width: 17px; height: 17px; color: var(--brand-dark); flex: none; }
.wh-file-info div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wh-file-info span { font-size: 11px; color: var(--muted); }
.wh-wizard-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.wh-wizard-foot .spacer { flex: 1; }
.wh-ack {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #92400e;
  background: var(--brand-soft);
  border: 1px solid #fde68a;
  border-radius: 9px;
  padding: 10px 12px;
  cursor: pointer;
}
.wh-ack input { margin-top: 1px; }
.wh-warn-list { margin: 6px 0 0 16px; padding: 0; }
.wh-warn-list li { margin-bottom: 3px; line-height: 1.45; }
.wh-json {
  max-height: 240px;
  overflow: auto;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre;
}
#wh-items input, #wh-items select {
  padding: 6px 7px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
#wh-items td { vertical-align: middle; }

/* Khu vực bị chặn quyền xem */
.denied-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 24px; text-align: center; }
.denied-box > svg { width: 42px; height: 42px; color: var(--muted-2); }
.denied-box h2 { margin: 0; font-size: 17px; }
.denied-box p { margin: 0; max-width: 560px; font-size: 12.5px; line-height: 1.65; color: var(--muted); }
