body {
  background: #f0f2f5;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-nav-icon {
  border-radius: 50%;
  object-fit: cover;
}

.app-footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #dee2e6;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  user-select: none;
}

.license-banner {
  flex-shrink: 0;
  border-bottom: 1px solid #ffecb5 !important;
}

.license-banner.alert-success {
  border-bottom-color: #badbcc !important;
}

.font-monospace {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.85rem;
}

.about-modal .about-icon {
  display: block;
  width: auto;
  height: 88px;
  max-width: 100%;
  object-fit: contain;
}

.about-payment-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.about-qr-wrap {
  flex-shrink: 0;
  text-align: center;
}

.about-payment-qr {
  width: 140px;
  height: 140px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.about-payment-body {
  flex: 1;
  min-width: 0;
}

@media (max-width: 420px) {
  .about-payment-layout {
    flex-direction: column;
    align-items: center;
  }

  .about-payment-body {
    width: 100%;
  }
}

.about-section .about-steps li {
  margin-bottom: 0.35rem;
}

.about-section .about-steps li:last-child {
  margin-bottom: 0;
}

.main-layout {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

.main-layout > .row {
  height: 100%;
}

/* Sidebar cấu hình — cố định hẹp */
.col-sidebar {
  width: 220px;
  min-width: 220px;
  flex-shrink: 0;
}

.col-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.col-main > .d-flex {
  min-height: 0;
}

.col-history {
  width: 260px;
  min-width: 260px;
  flex-shrink: 0;
  height: 100%;
}

.col-results {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.results-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.results-card .card-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.results-card .card-footer {
  flex-shrink: 0;
}

.results-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scroll-padding-bottom: 0.5rem;
  padding-bottom: 0.5rem;
}

.cell-with-copy {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 0;
}

.cell-with-copy .cell-text {
  flex: 1;
  min-width: 0;
}

.cell-with-copy .cell-text.cell-trich-yeu {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.btn-copy-cell {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #adb5bd;
  padding: 0 0.15rem;
  line-height: 1.2;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

tr:hover .btn-copy-cell,
.btn-copy-cell:focus-visible {
  opacity: 1;
}

.btn-copy-cell:hover {
  color: #0d6efd;
}

.btn-copy-cell.copied {
  color: #198754;
  opacity: 1;
}

.form-label-sm {
  font-size: 0.75rem;
  color: #6c757d;
}

.drop-zone {
  border: 2px dashed #adb5bd;
  border-radius: 0.375rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: #0d6efd;
  background: #e7f1ff;
}

.drop-zone.has-file {
  border-color: #198754;
  background: #d1e7dd33;
}

.file-queue {
  max-height: 160px;
  overflow-y: auto;
  text-align: left;
}

.file-queue-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.35rem;
  margin-bottom: 0.2rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  font-size: 0.72rem;
  cursor: grab;
  user-select: none;
}

.file-queue-item:active {
  cursor: grabbing;
}

.file-queue-item.dragging {
  opacity: 0.45;
}

.file-queue-item.drag-over {
  border-color: #0d6efd;
  background: #e7f1ff;
}

.file-queue-item .fq-handle {
  color: #adb5bd;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.file-queue-item .fq-index {
  flex-shrink: 0;
  width: 1.1rem;
  text-align: center;
  font-weight: 700;
  color: #0d6efd;
  font-family: Consolas, monospace;
}

.file-queue-item .fq-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-queue-item .fq-remove {
  flex-shrink: 0;
  border: none;
  background: none;
  color: #dc3545;
  padding: 0 0.15rem;
  line-height: 1;
  opacity: 0.55;
  font-size: 0.85rem;
}

.file-queue-item .fq-remove:hover {
  opacity: 1;
}

.file-queue-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.file-queue-actions .btn-link {
  font-size: 0.68rem;
  padding: 0;
  text-decoration: none;
}

.history-list {
  overflow-y: auto;
  max-height: calc(100vh - 150px);
}

.history-item {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.15s;
}

.history-item:hover {
  background: #f8f9fa;
}

.history-item.active {
  background: #e7f1ff;
  border-left: 3px solid #0d6efd;
}

.history-item .hi-name {
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .hi-delete {
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.5;
}

.history-item:hover .hi-delete {
  opacity: 1;
}

.history-item .hi-seq {
  color: #0d6efd;
  font-weight: 700;
  font-family: Consolas, monospace;
  font-size: 0.75rem;
}

.history-item .hi-meta {
  font-size: 0.7rem;
  color: #6c757d;
}

#resultTable td {
  vertical-align: middle;
  font-size: 0.8rem;
}

#resultTable th {
  font-size: 0.75rem;
  white-space: nowrap;
}

#resultTable td:nth-child(2),
#resultTable td:nth-child(5) {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#resultTable td:nth-child(6) {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar {
  font-size: 0.7rem;
  font-weight: 600;
}

.card {
  border: none;
}

@media (max-width: 992px) {
  body { overflow: auto; }
  .main-layout { height: auto; overflow: visible; }
  .col-sidebar, .col-history {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
  }
  .history-list { max-height: 200px; }
  .results-table-wrap {
    flex: none;
    max-height: 400px;
  }
}

/* Trang hướng dẫn */
.guide-page {
  background: #f4f6f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: auto;
  height: auto;
}

.guide-container {
  flex: 1;
  max-width: 1200px;
}

.guide-toc {
  top: 0.75rem;
}

.guide-nav .nav-link {
  color: #495057;
  padding: 0.25rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}

.guide-nav .nav-link:hover {
  color: #0d6efd;
  border-left-color: #cfe2ff;
}

.guide-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid #e9ecef;
}

.guide-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.guide-heading {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.guide-heading i {
  margin-right: 0.35rem;
}

.guide-steps li + li {
  margin-top: 0.35rem;
}

.guide-table th,
.guide-table td {
  font-size: 0.875rem;
  vertical-align: top;
}

.guide-content {
  font-size: 0.925rem;
  line-height: 1.55;
}

.guide-pre {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.65rem 0.85rem;
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* SweetAlert2 — tránh scrollbar vô lý trên overlay / popup ngắn */
html.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown),
body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) {
  overflow: hidden !important;
}

.swal2-container {
  overflow-y: hidden !important;
  align-items: center;
}

.swal2-popup {
  overflow: visible !important;
  max-height: calc(100vh - 2.5rem);
}

.swal2-html-container {
  overflow: visible !important;
  max-height: none !important;
}

.swal2-popup.swal2-toast {
  overflow: hidden !important;
}

/* Chỉ danh sách dài trong thông báo mới cuộn bên trong */
.swal-scroll-list {
  max-height: min(40vh, 220px);
  overflow-y: auto;
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  text-align: left;
}
