@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap');

:root {
  --navy: #0b3a5b;
  --teal: #0e7c7b;
  --cream: #fff6d9;
  --cream-border: #f5d76e;
  --ink: #1a2332;
  /* Chỉnh tay độ rộng cột bảng tại đây, rồi deploy */
  --col-check-width: 44px;
  --col-no-width: 52px;
  --col-pkg-width: 150px;
  --col-mr-width: 300px;
  --col-mgmer-width: 300px;
  --col-scan-width: 150px;
  --col-osd-width: 300px;
  --col-system-width: 140px;
  --col-subcon-width: 150px;
  --col-date-width: 150px;
  --col-status-width: 250px;
  --col-file-width: 280px;
}

html,
body {
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: var(--ink);
}

body {
  min-height: 100vh;
}

.sidebar-scroll::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar,
.modal-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.sidebar-scroll::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb,
.modal-scroll::-webkit-scrollbar-thumb {
  background: #c5d0c8;
  border-radius: 999px;
}

.summary-row {
  background: var(--cream) !important;
  border-bottom: 2px solid var(--cream-border) !important;
}

.view-btn.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

.table-sticky thead tr.summary-row th {
  top: 0;
  z-index: 12;
}

.table-sticky thead tr.col-head th {
  top: 48px;
  z-index: 11;
  white-space: nowrap;
}

.table-sticky th.col-osd,
.table-sticky td.col-osd {
  width: var(--col-osd-width);
  max-width: var(--col-osd-width);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-sticky th.col-scan,
.table-sticky td.col-scan {
  width: var(--col-scan-width);
  max-width: var(--col-scan-width);
  white-space: nowrap;
}

.table-sticky th.col-check,
.table-sticky td.col-check { width: var(--col-check-width); max-width: var(--col-check-width); }
.table-sticky th.col-no,
.table-sticky td.col-no { width: var(--col-no-width); max-width: var(--col-no-width); }
.table-sticky th.col-pkg,
.table-sticky td.col-pkg { width: var(--col-pkg-width); max-width: var(--col-pkg-width); }
.table-sticky th.col-mr,
.table-sticky td.col-mr {
  width: var(--col-mr-width);
  max-width: var(--col-mr-width);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-sticky th.col-mgmer,
.table-sticky td.col-mgmer {
  width: var(--col-mgmer-width);
  max-width: var(--col-mgmer-width);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-sticky th.col-system,
.table-sticky td.col-system {
  width: var(--col-system-width);
  max-width: var(--col-system-width);
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-sticky th.col-subcon,
.table-sticky td.col-subcon { width: var(--col-subcon-width); max-width: var(--col-subcon-width); }
.table-sticky th.col-date,
.table-sticky td.col-date { width: var(--col-date-width); max-width: var(--col-date-width); white-space: nowrap; }
.table-sticky th.col-status,
.table-sticky td.col-status { width: var(--col-status-width); min-width: var(--col-status-width); }
.table-sticky th.col-file,
.table-sticky td.col-file { width: var(--col-file-width); min-width: var(--col-file-width); white-space: nowrap; }

.scan-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.scan-badge-on {
  border: 1px solid #6ee7b7;
  background: #ecfdf5;
  color: #047857;
}

.scan-badge-off {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #64748b;
}

.scan-badge-empty {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  font-weight: 500;
}

.row-has-drive td {
  background: #f0fdf9;
}

.row-click {
  cursor: pointer;
}

.row-status {
  cursor: pointer;
}

.table-sticky thead th:first-child,
.table-sticky tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 8;
  background: #fff;
  box-shadow: 4px 0 8px -6px rgba(15, 23, 42, 0.25);
}

.table-sticky tbody tr.row-has-drive td,
.table-sticky tbody tr.row-has-drive td:first-child {
  background: #f0fdf9;
}

.table-sticky tbody tr.row-has-drive td:first-child {
  box-shadow: inset 4px 0 0 #059669, 4px 0 8px -6px rgba(15, 23, 42, 0.25);
}

.table-sticky thead tr.col-head th:first-child {
  z-index: 13;
  background: #f8fafc;
}

.table-sticky thead tr.summary-row th:first-child {
  position: static;
  box-shadow: none;
}

.excel-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.voucher-paper {
  max-width: 980px;
  margin: 0 auto 24px;
  background: #fff;
  border: 1px solid #d5dee7;
  box-shadow: 0 10px 30px rgba(11, 58, 91, 0.08);
  padding: 20px 22px 28px;
}

.voucher-brand {
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) minmax(110px, 170px);
  gap: 12px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 2px solid #0b3a5b;
}

.voucher-logo-stack {
  position: relative;
  display: flex;
  align-items: center;
  height: 64px;
  overflow: hidden;
}

.voucher-logo-stack.left {
  justify-content: flex-start;
}

.voucher-logo-stack.right {
  justify-content: flex-end;
}

.voucher-logo-stack img {
  height: 64px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  object-position: center;
}

.voucher-brand-text {
  text-align: center;
}

.voucher-project {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0b3a5b;
}

.voucher-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  color: #08283f;
}

.voucher-title-en {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #5b6b7c;
}

.voucher-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 20px;
  margin: 16px 0;
}

@media (min-width: 640px) {
  .voucher-meta {
    grid-template-columns: 1fr 1fr;
  }
}

.voucher-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef2f5;
}

.voucher-label {
  font-size: 11px;
  font-weight: 600;
  color: #5b6b7c;
}

.voucher-value {
  font-size: 13px;
  font-weight: 600;
  color: #1a2332;
  white-space: pre-wrap;
}

.voucher-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.voucher-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.voucher-items th {
  background: #0b3a5b;
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.voucher-items td {
  border: 1px solid #d5dee7;
  padding: 7px 10px;
  vertical-align: top;
}

.voucher-items tbody tr:nth-child(even) {
  background: #f7fafb;
}

.voucher-total td {
  font-weight: 700;
  background: #eef4f6;
  border: 1px solid #d5dee7;
  padding: 8px 10px;
}

.voucher-no-items {
  text-align: center;
  color: #5b6b7c;
  font-style: italic;
  padding: 18px 10px !important;
}

.voucher-foot {
  margin-top: 18px;
}

.voucher-note {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.voucher-sign-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 10px 0 16px;
}

.voucher-sign {
  min-height: 88px;
  border: 1px dashed #c5d0c8;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #0b3a5b;
  text-align: center;
}

.voucher-empty-note {
  max-width: 980px;
  margin: 0 auto 12px;
  padding: 10px 12px;
  border: 1px solid #f5d76e;
  background: #fff6d9;
  color: #5c4a12;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .voucher-paper {
    padding: 14px 12px 20px;
  }
  .voucher-brand {
    grid-template-columns: 72px 1fr 88px;
    gap: 6px;
  }
  .voucher-logo-stack {
    height: 48px;
  }
  .voucher-logo-stack img {
    height: 48px;
    max-width: 88px;
  }
  .voucher-title {
    font-size: 13px;
  }
}

.view-kind.active {
  background: #0e7c7b;
  color: #fff;
}

.pdf-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(78vh, 920px);
  border: 0;
  background: #525659;
}

.drive-frame-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: min(78vh, 920px);
}

.drive-frame-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 12px;
}

.drive-frame-bar a {
  font-weight: 600;
  color: #0b6564;
  text-decoration: none;
}

.drive-frame-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.drive-bar-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.drive-bar-btn-danger {
  border-color: #fecaca;
  color: #b91c1c;
}

.drive-frame-wrap .pdf-frame {
  flex: 1;
  min-height: 0;
  border-radius: 8px;
}

a.view-mr,
a.view-mgmer,
a.view-scan-bb,
a.view-scan-osd {
  display: inline-block;
  text-decoration: none;
}

body.viewer-only {
  background: #e8eef2;
  overflow: hidden;
}

body.viewer-only #app-shell,
body.viewer-only #sidebar,
body.viewer-only #sidebar-backdrop,
body.viewer-only #main,
body.viewer-only #modal {
  display: none !important;
}

body.viewer-only #xlsx-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #e8eef2;
}

body.viewer-only #xlsx-viewer > div {
  border-radius: 0;
  min-height: 100vh;
  height: 100vh;
  box-shadow: none;
}

.toast {
  animation: toast-in 0.25s ease-out;
}

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

@media print {
  #sidebar,
  #toolbar,
  #mobile-bar,
  #modal,
  .no-print {
    display: none !important;
  }

  #main {
    margin: 0 !important;
    padding: 0 !important;
  }
}
