/* ─────────────────────────────────────────────────────────────
   TOOL BÁO CÁO ĐIỀU HÀNH – giao diện ứng dụng (khung, form, bảng)
   Phần hiển thị báo cáo infographic nằm ở report.css
   ───────────────────────────────────────────────────────────── */

:root {
  --navy: #12295c;
  --navy-2: #1b3a73;
  --navy-3: #0d1f45;
  --ink: #16233f;
  --muted: #5f6f8f;
  --line: #dde3ee;
  --line-2: #eef2f8;
  --bg: #eef2f8;
  --bg-soft: #f6f8fc;
  --white: #ffffff;

  --green: #1a7f37;
  --green-soft: #e7f6ec;
  --amber: #e08a00;
  --amber-soft: #fdf3e0;
  --red: #d92d20;
  --red-soft: #fdeceb;
  --orange: #f26522;
  --purple: #5b2d8e;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(18, 41, 92, .06), 0 4px 14px rgba(18, 41, 92, .07);
  --shadow-lg: 0 8px 30px rgba(18, 41, 92, .13);
  --font: 'Segoe UI', 'Be Vietnam Pro', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Lưới an toàn: SVG không khai báo kích thước sẽ mặc định giãn 300×150px.
   :where() có độ ưu tiên 0 nên mọi quy tắc .xxx svg bên dưới vẫn thắng. */
:where(svg) { width: 17px; height: 17px; flex: none; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-2); }

/* ───────────────────────────────── Thanh điều hướng */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  height: 58px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 12px rgba(13, 31, 69, .28);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
}

.topbar-brand svg { width: 26px; height: 26px; }

/* Logo là chữ xanh đậm nên cần nền trắng mới đọc được trên thanh navy */
.topbar-brand .brand-logo {
  height: 34px;
  width: auto;
  padding: 4px 7px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.topbar-brand small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  opacity: .72;
  line-height: 1.1;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.topnav::-webkit-scrollbar { display: none; }

.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.topnav a svg { width: 16px; height: 16px; }
.topnav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.topnav a.active { background: #fff; color: var(--navy); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.topbar-user .who {
  text-align: right;
  line-height: 1.2;
  font-size: 12.5px;
}

.topbar-user .who b { display: block; font-size: 13px; }
.topbar-user .who span { opacity: .7; font-size: 11px; }

/* ───────────────────────────────── Bố cục trang */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 20px 60px;
}

.page-wide { max-width: 1720px; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.2px;
}

.page-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* Huy hiệu icon nền màu phòng ban (tiêu đề trang, danh sách tổng hợp) */
.ic-badge {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 9px;
  color: #fff;
}

.ic-badge.lg { width: 34px; height: 34px; }
.ic-badge.lg svg { width: 20px; height: 20px; }
.ic-badge.sm { width: 22px; height: 22px; border-radius: 6px; }
.ic-badge.sm svg { width: 13px; height: 13px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ───────────────────────────────── Nút */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .06s, box-shadow .15s;
}

.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--bg-soft); border-color: #c9d3e6; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }

.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #15672c; border-color: #15672c; }

.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-orange:hover { background: #d9531a; border-color: #d9531a; }

.btn-danger { color: var(--red); border-color: #f3c9c6; background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: #e9a9a4; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(18, 41, 92, .07); color: var(--ink); }

.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { padding: 7px; }

/* ───────────────────────────────── Thẻ & form */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}

.card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head h2 svg { width: 17px; height: 17px; }
.card-body { padding: 16px 18px; }

.field { margin-bottom: 13px; }

.field > label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
}

.field .hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="month"], input[type="week"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

textarea { resize: vertical; min-height: 62px; line-height: 1.45; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-2);
  box-shadow: 0 0 0 3px rgba(27, 58, 115, .12);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--bg-soft);
  color: var(--muted);
  cursor: not-allowed;
}

.row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* ───────────────────────────────── Bảng */
.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th {
  text-align: left;
  padding: 9px 11px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

table.data td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}

table.data tbody tr:hover { background: #fbfcfe; }
table.data tbody tr:last-child td { border-bottom: none; }

/* ───────────────────────────────── Nhãn trạng thái */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-gray { background: #eef1f6; color: var(--muted); }
.pill-navy { background: #e8eef9; color: var(--navy-2); }

/* ───────────────────────────────── Lưới phòng ban */
.dept-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
}

.dept-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform .12s, box-shadow .18s, border-color .18s;
}

.dept-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent, var(--navy));
}

.dept-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: #c9d5ea;
}

.dept-card-top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.dept-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent, var(--navy));
  color: #fff;
}

.dept-icon svg { width: 23px; height: 23px; }

.dept-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.25;
}

.dept-card .owner {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.dept-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--muted);
}

.stat-chip b { font-size: 14px; }
.stat-chip.green { background: var(--green-soft); color: var(--green); }
.stat-chip.amber { background: var(--amber-soft); color: var(--amber); }
.stat-chip.red { background: var(--red-soft); color: var(--red); }

/* ───────────────────────────────── Đăng nhập */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 600px at 12% -10%, #1e3f7d 0%, transparent 60%),
    radial-gradient(900px 500px at 105% 110%, #24508f 0%, transparent 55%),
    var(--navy-3);
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 30px 30px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .32);
}

.login-logo {
  text-align: center;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-2);
}

.login-logo img {
  width: 172px;
  height: auto;
  margin-bottom: 14px;
}

.login-logo h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}

.login-logo p {
  margin: 3px 0 0;
  font-size: 11px;
  letter-spacing: .9px;
  color: var(--muted);
  font-weight: 600;
}

.login-hint {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.login-hint code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11.5px;
  color: var(--navy-2);
}

/* ───────────────────────────────── Thông báo */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-error { background: var(--red-soft); color: #96201a; }
.alert-ok { background: var(--green-soft); color: #14622b; }
.alert-info { background: #e8eef9; color: var(--navy-2); }
.alert-warn { background: var(--amber-soft); color: #8a5500; }

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in .22s ease-out;
  max-width: 400px;
}

.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ───────────────────────────────── Trình soạn báo cáo */
.editor-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: start;
}

@media (max-width: 1180px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  /* một cột: khung xem trước nằm dưới, không cần bám màn hình */
  .editor-layout .preview-shell { position: static; max-height: none; }
}

.editor-pane {
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.editor-pane::-webkit-scrollbar { width: 9px; }
.editor-pane::-webkit-scrollbar-thumb { background: #cfd8e8; border-radius: 9px; }

.acc { border-bottom: 1px solid var(--line-2); }
.acc:last-child { border-bottom: none; }

.acc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 18px;
  background: none;
  border: none;
  font: inherit;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--navy);
  cursor: pointer;
  text-align: left;
}

.acc-head:hover { background: var(--bg-soft); }
.acc-head .chev { margin-left: auto; transition: transform .18s; }
.acc-head .chev svg { width: 16px; height: 16px; color: var(--muted); }
.acc.open .acc-head .chev { transform: rotate(180deg); }

.acc-num {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
}

.acc-body { display: none; padding: 4px 18px 18px; }
.acc.open .acc-body { display: block; }

.repeater-item {
  position: relative;
  padding: 13px 13px 4px;
  margin-bottom: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
}

.repeater-item .del {
  position: absolute;
  top: 9px;
  right: 9px;
}

.repeater-item .idx {
  display: inline-block;
  margin-bottom: 9px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .4px;
}

.kpi-editor {
  display: grid;
  gap: 9px;
  grid-template-columns: 1fr;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-bottom: 10px;
  background: var(--bg-soft);
}

.kpi-editor.is-green { border-left: 4px solid var(--green); }
.kpi-editor.is-amber { border-left: 4px solid var(--amber); }
.kpi-editor.is-red { border-left: 4px solid var(--red); }

.kpi-editor-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
}

.kpi-editor-head .n {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

.kpi-editor-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 640px) {
  .kpi-editor-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi-editor-grid label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.kpi-editor-grid input, .kpi-editor-grid select {
  padding: 6px 8px;
  font-size: 12.5px;
}

/* ───────────────────────────────── Khung xem trước báo cáo */
.preview-shell {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Trong trang nhập số liệu: khung xem trước bám theo màn hình như cột nhập */
.editor-layout .preview-shell {
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 96px);
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, #fff, var(--bg-soft));
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

/* Bắt buộc: thiếu dòng này icon sẽ giãn kín cả thanh */
.preview-bar svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--navy-2);
}

.preview-bar .spacer { flex: 1; }

.preview-bar .zoom {
  flex: none;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy-2);
  font-variant-numeric: tabular-nums;
}

.report-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background:
    radial-gradient(circle at 1px 1px, rgba(18, 41, 92, .1) 1px, transparent 0) 0 0 / 16px 16px,
    #e9eef7;
}

.report-viewport::-webkit-scrollbar { width: 9px; height: 9px; }
.report-viewport::-webkit-scrollbar-thumb { background: #bdc9de; border-radius: 9px; }

.report-scaler { transform-origin: top left; }

/* Bản báo cáo nổi lên như một tờ giấy đặt trên bàn */
.report-scaler > * { box-shadow: 0 6px 26px rgba(18, 41, 92, .2); }

/* ───────────────────────────────── Dashboard tổng hợp */
.kpi-tiles {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  margin-bottom: 18px;
}

.tile {
  padding: 15px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.tile .label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tile .label svg { width: 15px; height: 15px; }
.tile .value { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1.15; margin-top: 6px; }
.tile.green .value { color: var(--green); }
.tile.amber .value { color: var(--amber); }
.tile.red .value { color: var(--red); }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.overview-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

.ov-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ov-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: #fff;
  background: var(--accent, var(--navy));
}

.ov-head svg { width: 19px; height: 19px; }
.ov-head h3 { margin: 0; font-size: 14px; font-weight: 800; flex: 1; }
.ov-body { padding: 12px 14px; }

.mini-kpis {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 11px;
}

.mini-kpi {
  padding: 7px 6px;
  border-radius: 8px;
  text-align: center;
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
}

.mini-kpi .v { font-size: 13.5px; font-weight: 800; color: var(--navy); line-height: 1.2; }
.mini-kpi .n {
  font-size: 9.5px;
  color: var(--muted);
  line-height: 1.25;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mini-kpi.green { background: var(--green-soft); border-color: #cdebd7; }
.mini-kpi.green .v { color: var(--green); }
.mini-kpi.amber { background: var(--amber-soft); border-color: #f6e0b8; }
.mini-kpi.amber .v { color: var(--amber); }
.mini-kpi.red { background: var(--red-soft); border-color: #f6cdc9; }
.mini-kpi.red .v { color: var(--red); }

.ov-exceptions { font-size: 12.3px; }

.ov-exceptions li {
  display: flex;
  gap: 7px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line-2);
  line-height: 1.4;
}

.ov-exceptions li:last-child { border-bottom: none; }
.ov-exceptions ul { margin: 0; padding: 0; list-style: none; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  margin-top: 5px;
}

.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }
.dot.green { background: var(--green); }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.empty svg { width: 40px; height: 40px; opacity: .35; margin-bottom: 10px; }
.empty h3 { margin: 0 0 5px; font-size: 15px; color: var(--ink); }
.empty p { margin: 0 0 14px; font-size: 13px; }

/* ───────────────────────────────── Hộp thoại */
.modal-host {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 31, 69, .5);
  backdrop-filter: blur(2px);
}

.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .32);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-2);
}

.modal-head h2 { margin: 0; font-size: 16px; font-weight: 800; color: var(--navy); }
.modal-body { padding: 18px 20px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-2);
  background: var(--bg-soft);
  border-radius: 0 0 15px 15px;
}

/* ───────────────────────────────── Trạng thái tải */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--muted);
  font-weight: 600;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #d6deee;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: rgba(13, 31, 69, .55);
  color: #fff;
  font-weight: 700;
  gap: 12px;
}

.busy-overlay .spinner {
  border-color: rgba(255, 255, 255, .3);
  border-top-color: #fff;
  width: 26px;
  height: 26px;
}

.busy-overlay .box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 26px 34px;
  background: rgba(13, 31, 69, .85);
  border-radius: 14px;
}

/* ───────────────────────────────── In ấn */
@media print {
  .topbar, .toolbar, .preview-bar, .editor-pane, .page-head, .toast-host { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .report-viewport { overflow: visible; padding: 0; background: #fff; max-height: none; }
  .preview-shell, .editor-layout .preview-shell {
    position: static;
    max-height: none;
    border: none;
    box-shadow: none;
  }
  .report-scaler > * { box-shadow: none; }
  .editor-layout { display: block; }
}
