/* ============ GlobalLogistics ERP — design system ============ */
:root {
  --navy-900: #0b1220;
  --navy-800: #111c2f;
  --navy-700: #16233a;
  --navy-600: #1d2d48;
  --brand-600: #1d4ed8;
  --brand-500: #2563eb;
  --brand-100: #dbeafe;
  --teal-500: #0d9488;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e3e8f0;
  --border-strong: #cfd8e6;
  --text: #101828;
  --text-2: #475467;
  --text-3: #8794a7;
  --ok: #059669;
  --ok-bg: #d1fae5;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #dc2626;
  --bad-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #e0e7ff;
  --muted-bg: #eef2f7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
  --sidebar-w: 268px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--muted-bg); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.req { color: var(--bad); }

/* ---------- boot ---------- */
.boot-screen {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: var(--navy-900); color: #cbd5e1; z-index: 200;
}
.boot-logo { font-size: 34px; color: #60a5fa; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- login ---------- */
.login-screen { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.login-art {
  background: radial-gradient(1100px 620px at 8% 8%, #1e3a8a 0%, #0b1220 62%, #070c15 100%);
  color: #e2e8f0; padding: 56px 52px; display: flex; align-items: center; position: relative; overflow: hidden;
}
.login-art::after {
  content: ""; position: absolute; width: 460px; height: 460px; right: -140px; bottom: -180px;
  background: radial-gradient(circle, rgba(37, 99, 235, .38), transparent 68%);
}
.login-art-inner { max-width: 460px; position: relative; z-index: 1; }
.login-art h1 { font-size: 34px; margin: 18px 0 14px; color: #fff; }
.login-art h1 span { color: #60a5fa; font-weight: 600; }
.login-art p { color: #a9b8ce; font-size: 14.5px; line-height: 1.7; }
.login-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.login-points li { display: flex; gap: 10px; align-items: center; color: #cdd9ea; font-size: 13.5px; }
.login-points i {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(96, 165, 250, .16); color: #60a5fa; font-size: 10px; flex: 0 0 auto;
}
.brand-mark {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, #2563eb, #1e40af); color: #fff; font-size: 22px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .38);
}
.brand-mark.small { width: 38px; height: 38px; font-size: 16px; border-radius: 11px; box-shadow: none; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; margin-bottom: 6px; }
.login-card > .muted { margin-bottom: 22px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn-block { margin-top: 8px; }
.login-help { margin-top: 14px; text-align: center; font-size: 13px; }
.link-btn {
  font: inherit; font-size: 13px; background: none; border: 0; padding: 0;
  color: var(--brand-600); cursor: pointer; text-decoration: underline;
}
.link-btn:hover { color: var(--brand-500); }
/* Bắt buộc đổi mật khẩu / đặt lại mật khẩu: một cột, không có khối minh hoạ bên trái. */
#gate-screen { grid-template-columns: 1fr; }
.gate-card { width: 100%; max-width: 420px; }
.form-error {
  background: var(--bad-bg); color: var(--bad); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px; margin-bottom: 12px;
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  color: #c7d3e3; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 60;
}
.sidebar-head { display: flex; align-items: center; gap: 11px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { color: #fff; font-size: 14.5px; }
.brand-text span { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #6b82a4; }
.nav { padding: 12px 10px 20px; flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-group-title {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #5c7191;
  padding: 8px 10px 6px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8.5px 10px; border-radius: 9px;
  color: #c3d0e1; font-size: 13.3px; cursor: pointer; transition: .14s; margin-bottom: 1px;
  border: none; background: none; width: 100%; text-align: left; font-family: inherit;
}
.nav-item i { width: 17px; text-align: center; font-size: 13px; color: #7a8fb0; flex: 0 0 auto; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(37, 99, 235, .95), rgba(37, 99, 235, .62)); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .3); }
.nav-item.active i { color: #fff; }
.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .07); }
.company-line { font-size: 11px; color: #6b82a4; line-height: 1.55; }
.sidebar-backdrop { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h2 { font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: 999px; background: var(--muted-bg); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, #2563eb, #1e40af); color: #fff; font-size: 12px; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 12.5px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; display: grid; place-items: center;
  transition: .15s; font-size: 13px;
}
.icon-btn:hover { background: var(--muted-bg); color: var(--text); }
.view { padding: 22px 24px 48px; flex: 1; max-width: 1600px; width: 100%; }

/* ---------- page bits ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h3 { font-size: 19px; }
.page-head .page-desc { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.page-head .spacer { flex: 1; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.card-head h4 { font-size: 14.5px; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 13.2px; font-weight: 600; padding: 9px 15px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-500); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .28); }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--muted-bg); color: var(--text); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 6px 11px; font-size: 12.3px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover:not(:disabled) { background: #047857; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi .kpi-label { font-size: 12px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .kpi-label i { color: var(--brand-500); }
.kpi .kpi-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.kpi .kpi-note { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.kpi.accent { background: linear-gradient(135deg, #1e3a8a, #1d4ed8); color: #fff; border-color: transparent; }
.kpi.accent .kpi-label, .kpi.accent .kpi-note { color: #c7d7f7; }
.kpi.accent .kpi-label i { color: #93c5fd; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ---------- table ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.2px; }
table.data thead th {
  text-align: left; padding: 11px 14px; background: #f8fafc; color: var(--text-2);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .045em; font-weight: 700;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
table.data tbody tr:hover { background: #f9fbff; }
table.data tbody tr:last-child td { border-bottom: none; }
td.strong { font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions-cell { white-space: nowrap; text-align: right; }
.actions-cell .icon-btn { width: 28px; height: 28px; font-size: 12px; }
.row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.icon-btn.danger:hover { background: var(--bad-bg); color: var(--bad); border-color: #fecaca; }
.icon-btn.ok:hover { background: var(--ok-bg); color: var(--ok); border-color: #a7f3d0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--muted-bg); color: var(--text-2); }

/* toolbar */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.search-box { position: relative; flex: 1; min-width: 190px; max-width: 340px; }
.search-box i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 12.5px; }
.search-box input { padding-left: 32px; }
select.filter { max-width: 190px; }
.toolbar .spacer { flex: 1; }

.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.pager .spacer { flex: 1; }

/* ---------- forms ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="month"], select, textarea {
  width: 100%; font: inherit; font-size: 13.4px; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text); transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
textarea { resize: vertical; min-height: 72px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.3px; font-weight: 600; color: var(--text-2); }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(9, 15, 28, .55); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 120;
  overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 720px; animation: pop .16s ease-out;
}
.modal.narrow { max-width: 440px; }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; flex: 1; }
.modal-body { padding: 18px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-height: 62vh; overflow-y: auto; }
.modal-body .field.full { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--border); background: #fafbfe; border-radius: 0 0 14px 14px; }
.modal-text { padding: 20px; font-size: 13.6px; color: var(--text-2); }

/* ---------- toast ---------- */
.toast-root { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 9px; z-index: 300; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: 10px;
  background: #111c2f; color: #fff; font-size: 13.2px; box-shadow: var(--shadow-md);
  animation: slideIn .18s ease-out; max-width: 380px;
}
.toast i { font-size: 14px; }
.toast.ok i { color: #34d399; }
.toast.bad i { color: #f87171; }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ---------- states ---------- */
.state { padding: 42px 20px; text-align: center; color: var(--text-3); }
.state i { font-size: 30px; margin-bottom: 12px; display: block; color: var(--border-strong); }
.state.error i { color: #fca5a5; }
.state p { font-size: 13.5px; margin-bottom: 12px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border);
  border-top-color: var(--brand-500); animation: spin .7s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #eef2f7, #f7f9fc, #eef2f7); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- misc ---------- */
.progress { height: 7px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #0d9488); border-radius: 999px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
/* Bộ lọc nhiều trường (nhật ký, thùng rác, báo cáo) — tự xuống dòng theo bề rộng màn hình. */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; }
.filters .field { margin: 0; }
.filters .field .btn { width: 100%; justify-content: center; }
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid #eef1f6; }
.mini-item:last-child { border-bottom: none; }
.mini-item .grow { flex: 1; min-width: 0; }
.mini-item .t1 { font-size: 13.2px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .t2 { font-size: 11.8px; color: var(--text-3); }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 300px; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.tabs { display: inline-flex; gap: 4px; background: var(--muted-bg); padding: 4px; border-radius: 10px; }
.tabs button {
  font: inherit; font-size: 12.8px; font-weight: 600; padding: 6px 14px; border-radius: 7px;
  border: none; background: none; color: var(--text-2); cursor: pointer; transition: .15s;
}
.tabs button.active { background: #fff; color: var(--brand-600); box-shadow: var(--shadow-sm); }
.file-link { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }

/* ---------- quotation module (CS) ---------- */
.quote-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.quote-layout > .stack { min-width: 0; }
.sticky-side { position: sticky; top: 78px; }
.q-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 13px; }
.q-grid textarea { min-height: 60px; }
.q-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #eef1f6; font-size: 13px; }
.q-sum:last-of-type { border-bottom: none; }
.q-sum span { color: var(--text-2); }
.q-sum b { font-variant-numeric: tabular-nums; }
.q-btn-col { display: flex; flex-direction: column; gap: 8px; }
.q-btn-col .btn { justify-content: flex-start; }
.q-chip { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.q-chip.ok { background: var(--ok-bg); color: var(--ok); }
.q-chip.bad { background: var(--bad-bg); color: var(--bad); }
.q-violations { margin-top: 10px; }
.q-ok-line { font-size: 12.5px; color: var(--ok); display: flex; gap: 7px; align-items: flex-start; }
.q-warn-box { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; }
.q-warn-box ul { margin: 6px 0 0; padding-left: 18px; }
.q-meta-row { font-size: 12.5px; color: var(--text-2); padding: 3px 0; }
.q-banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px; line-height: 1.55;
}
.q-banner.warn { background: var(--warn-bg); color: var(--warn); }
.q-banner.bad { background: var(--bad-bg); color: var(--bad); }
.q-banner i { margin-top: 2px; }

/* line editor */
.q-lines table.data { font-size: 12.8px; }
.q-lines thead th { padding: 9px 8px; }
.q-lines tbody td { padding: 7px 6px; vertical-align: top; border-bottom: 1px solid #eef1f6; }
.q-lines input, .q-lines select { font-size: 12.8px; padding: 6px 8px; }
.q-lines .q-main { min-width: 240px; }
.q-lines .q-main input, .q-lines .q-main select { margin-bottom: 4px; }
.q-lines .q-desc { font-size: 12px; color: var(--text-2); }
.q-lines .q-idx { color: var(--text-3); font-weight: 700; padding-top: 12px; }
.q-lines .w-70 { width: 70px; } .q-lines .w-75 { width: 75px; }
.q-lines .w-80 { width: 80px; } .q-lines .w-110 { width: 110px; }
.q-lines .num { text-align: right; }
.q-lines input.q-input-warn { border-color: #f59e0b; background: #fffbeb; }
.q-lines-foot { padding: 10px 16px 14px; }
.q-template-body { display: block !important; }
.q-tpl-form { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.q-tpl-form .field.full { grid-column: 1 / -1; }
.modal.wide { max-width: 900px; }
.q-preview-body { padding: 14px 18px; background: #eef2f7; text-align: center; max-height: 66vh; overflow: auto; }
.q-preview-body img { max-width: 100%; border-radius: 8px; box-shadow: var(--shadow-md); background: #fff; }

@media (max-width: 1100px) {
  .quote-layout { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
}
@media (max-width: 720px) {
  .q-tpl-form { grid-template-columns: 1fr; }
  .q-btn-col .btn { justify-content: center; }
}

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 282px;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .3); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(9, 15, 28, .45); z-index: 55; }
  .menu-btn { display: grid; }
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .view { padding: 16px 14px 44px; }
  .topbar { padding: 10px 14px; }
  .user-meta { display: none; }
  .topbar-title h2 { font-size: 15.5px; }
  .modal-body { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .kpi .kpi-value { font-size: 18px; }
  .search-box { max-width: none; }
  .page-head h3 { font-size: 17px; }
}

/* ---------- xuất / nhập dữ liệu ---------- */
.btn-menu { position: relative; display: inline-flex; }
.menu-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 140; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.menu-pop.hidden { display: none; }
.menu-pop button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  font: inherit; font-size: 13px; padding: 9px 11px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-1); cursor: pointer;
}
.menu-pop button:hover { background: var(--muted-bg); }
.menu-pop i { color: var(--text-2); width: 14px; text-align: center; }

.iw-body { padding: 16px 20px; max-height: 70vh; overflow-y: auto; }
.iw-steps { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; }
.iw-step { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.iw-step-no {
  width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
  background: var(--muted-bg); font-size: 11.5px; font-weight: 700;
}
.iw-step.active { color: var(--text-1); font-weight: 600; }
.iw-step.active .iw-step-no { background: var(--brand, #2563eb); color: #fff; }
.iw-step.done .iw-step-no { background: var(--ok-bg); color: var(--ok); }
.iw-pane p { margin: 0 0 8px; }
.iw-file-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--muted-bg); border-radius: var(--radius-sm); font-size: 12.8px; margin: 10px 0;
}
.iw-busy { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; }
.iw-map select { width: 100%; }
.iw-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.iw-sum {
  flex: 1 1 110px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--muted-bg); display: flex; flex-direction: column; gap: 2px;
}
.iw-sum b { font-size: 18px; font-variant-numeric: tabular-nums; }
.iw-sum span { font-size: 11.5px; color: var(--text-2); }
.iw-sum.ok { background: var(--ok-bg); }
.iw-sum.ok b { color: var(--ok); }
.iw-sum.warn { background: var(--warn-bg); }
.iw-sum.warn b { color: var(--warn); }
.iw-sum.bad { background: var(--bad-bg); }
.iw-sum.bad b { color: var(--bad); }
.iw-dup {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px;
}
.iw-dup label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.8px; }
.iw-err-text { color: var(--bad); }
.iw-badge.ok { background: var(--ok-bg); color: var(--ok); }
.iw-badge.warn { background: var(--warn-bg); color: var(--warn); }
.iw-badge.bad { background: var(--bad-bg); color: var(--bad); }
.iw-badge.muted { background: var(--muted-bg); color: var(--text-2); }

@media (max-width: 720px) {
  .btn-menu { flex: 1 1 auto; }
  .btn-menu > .btn { width: 100%; }
  .menu-pop { right: auto; left: 0; min-width: 100%; }
  .iw-body { padding: 14px 14px; max-height: 66vh; }
  .iw-sum { flex: 1 1 92px; padding: 8px 10px; }
  .iw-sum b { font-size: 16px; }
}
