body {
  background: #f5f7fb;
}

/* Compact journal rows and keep account picker visible */
.modern-voucher-card,
.journal-table-wrap,
.journal-grid,
.journal-grid tbody,
.journal-grid tr,
.journal-grid td {
  overflow: visible !important;
}

.journal-grid td {
  padding: 8px 10px !important;
}

.journal-grid tbody tr:hover {
  transform: none !important;
}

.journal-grid .account-picker-input,
.journal-grid .debit,
.journal-grid .credit,
.journal-grid .form-control {
  min-height: 38px !important;
}

.account-picker-results.is-floating {
  z-index: 10050 !important;
}

.container-fluid.py-3 {
  max-width: none;
  padding-inline: clamp(14px, 2vw, 28px);
}

.voucher-print-head {
  display: none;
}

.voucher-print-signatures {
  display: none;
}

/* =====================================
   HARPLINK ERP - Journal Entry Screen
   ===================================== */

/* =========================
   3D Cards
========================= */
.card-3d {
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, .05);
  transition: all .25s ease;
}

.card-3d:hover {
  transform: translateY(-3px);
  box-shadow:
    0 18px 35px rgba(0,0,0,0.08),
    0 6px 10px rgba(0,0,0,0.06);
}

/* =========================
   Header
========================= */
.voucher-header {
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, .22), transparent 34%),
    linear-gradient(135deg, #1e293b, #334155);
  color: #fff;
  padding: 24px;
  border-radius: 28px;
  box-shadow: 0 22px 44px rgba(15, 23, 42, .12);
  gap: 18px;
}

.voucher-header h4 {
  font-size: 1.8rem;
  font-weight: 900;
}

/* =========================
   Totals Card
========================= */
.totals-card {
  background: linear-gradient(135deg, #f8fafc, #e0f2fe);
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 24px;
  padding: 18px 30px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.05);
}

.total-box {
  text-align: center;
}

.total-label { 
  font-size: 14px;
  color: #6b7280;
}

.total-value {
  font-size: 22px;
  font-weight: 700;
}

.total-debit { color: #16a34a; }
.total-credit { color: #dc2626; }
.total-diff-ok { color: #2563eb; }
.total-diff-error { color: #b91c1c; }

/* =========================
   Table Polish
========================= */
.table thead {
  background: #f1f5f9;
}

.modern-voucher-card {
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 24px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, .05);
  overflow: hidden;
}

.modern-voucher-card label,
.modern-voucher-card .form-label,
.card-3d label,
.card-3d .form-label {
  color: #475569;
  font-size: .84rem;
  font-weight: 800;
}

.modern-voucher-card .form-control,
.modern-voucher-card .form-select,
.card-3d .form-control,
.card-3d .form-select {
  min-height: 44px;
  border-radius: 14px;
  border-color: #dbe3ef;
}

.table tbody tr:hover {
  background-color: #f8fafc;
}

.totals-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #ffffff;
  box-shadow: 0 -5px 20px rgba(0,0,0,0.08);
  padding: 15px 30px;
}

body {
  padding-bottom: 110px;
}
@media (max-width: 768px) {

  .totals-fixed .row {
    flex-direction: column;
    gap: 10px;
  }

  .total-value {
    font-size: 18px;
  }

}

/* =========================
   Journal Table Professional
========================= */


/* Delete button */
.btn-del {
  border-radius: 10px;
}



.account-picker-input {
  background: #f8fafc;
  font-weight: 600;
}


/* =========================================
   HARPLINK Journal Grid v1
   ========================================= */

.journal-grid {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1040px;
}

/* Header */
.journal-grid thead th {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, .18);
  padding: 12px;
}

/* Row Card Style */
.journal-grid tbody tr {
  background: #ffffff;
  box-shadow: none;
  transition: all .2s ease;
}

.journal-grid tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.07);
}

.journal-grid td {
  border: 1px solid rgba(148, 163, 184, .16);
  vertical-align: middle;
  padding: 12px;
}

/* Row number */
.journal-grid .row-no {
  font-weight: 600;
  color: #94a3b8;
  width: 50px;
}

/* Account column */
.account-picker-input {
  background: #f8fafc;
  font-weight: 600;
  border-radius: 10px;
}

/* Debit */
.journal-grid .debit {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  font-weight: 600;
  text-align: end;
}

/* Credit */
.journal-grid .credit {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  font-weight: 600;
  text-align: end;
}

/* Focus row highlight */
.journal-grid tbody tr:focus-within {
  box-shadow: 0 0 0 2px #2563eb33;
}

/* Vertical divider between debit & credit */
.journal-grid td:nth-child(4),
.journal-grid th:nth-child(4) {
  border-left: 2px solid #e5e7eb;
}

/* Delete button */
.btn-del {
  border-radius: 8px;
  padding: 4px 8px;
}

/* =========================================
   Responsive Mode (Mobile)
   ========================================= */

@media (max-width: 768px) {

  .journal-grid thead {
    display: none;
  }

  .journal-grid tbody tr {
    display: block;
    padding: 10px;
  }

  .journal-grid tbody td {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
  }

  .journal-grid tbody td::before {
    font-weight: 600;
    color: #64748b;
  }

}
.row-debit-active {
  border-left: 5px solid #16a34a;
}

.row-credit-active {
  border-left: 5px solid #dc2626;
}

.custom-success-toast {

  position: fixed;
  top: 20px;
  right: 20px;

  background: #198754;
  color: white;

  padding: 12px 18px;

  border-radius: 10px;

  box-shadow: 0 5px 20px rgba(0,0,0,0.2);

  opacity: 0;
  transform: translateY(-10px);

  transition: all 0.3s ease;

  z-index: 9999;
}

.custom-success-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.opening-import-modal {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2vw, 22px);
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, .22), transparent 28%),
    rgba(15, 23, 42, .56);
  backdrop-filter: blur(8px);
}

.opening-import-dialog {
  width: min(1180px, 97vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 26px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, .32);
}

.opening-import-header,
.opening-import-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #f8fafc, #eef6ff);
  border-bottom: 1px solid #e2e8f0;
}

.opening-import-header strong {
  display: block;
  color: #0f172a;
  font-size: 1.15rem;
  font-weight: 900;
}

.opening-import-kicker {
  width: fit-content;
  margin-bottom: 5px;
  padding: 3px 10px;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.opening-import-footer {
  border-top: 1px solid #e2e8f0;
  border-bottom: 0;
}

.opening-import-body {
  padding: 18px 22px;
  overflow: auto;
}

.opening-import-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.opening-import-steps div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
}

.opening-import-steps span {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  border-radius: 12px;
  font-weight: 900;
}

.opening-import-steps strong,
.opening-import-steps small {
  display: block;
}

.opening-import-steps strong {
  color: #0f172a;
  font-weight: 900;
}

.opening-import-steps small {
  color: #64748b;
  font-weight: 700;
}

.opening-import-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
}

.opening-import-hint {
  margin-bottom: 14px;
  padding: 11px 13px;
  color: #475569;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 800;
}

.opening-import-mapping {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.opening-import-mapping label {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.opening-import-mapping .form-select,
.opening-import-upload .form-control {
  margin-top: 6px;
  border-radius: 14px;
}

.opening-import-preview-wrap {
  max-height: 420px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  overflow: auto;
  background: #ffffff;
}

.opening-import-actions {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid #e2e8f0;
}

.opening-import-preview {
  min-width: 940px;
  margin: 0;
}

.opening-import-preview thead th {
  position: sticky;
  top: 53px;
  z-index: 2;
  color: #334155;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  font-size: 12px;
  font-weight: 900;
}

.opening-import-preview td,
.opening-import-preview th {
  vertical-align: middle;
}

.opening-import-preview tbody tr:not(.table-warning):hover {
  background: #f8fafc;
}

.opening-import-preview .table-warning {
  --bs-table-bg: #fff7ed;
  color: #9a3412;
}

@media (max-width: 900px) {
  .voucher-header {
    align-items: flex-start !important;
    flex-direction: column;
  }

  .voucher-header .d-flex.gap-2 {
    width: 100%;
    flex-wrap: wrap;
  }

  .voucher-header .btn {
    flex: 1 1 auto;
  }

  .opening-import-dialog {
    width: 100%;
    max-height: 96vh;
    border-radius: 18px;
  }

  .opening-import-header,
  .opening-import-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .opening-import-steps,
  .opening-import-upload {
    grid-template-columns: 1fr;
  }

  .opening-import-actions {
    flex-wrap: wrap;
  }
}

@media print {
  .opening-import-modal {
    display: none !important;
  }

  @page journal-a4 {
    size: A4 portrait;
    margin: 10mm;
  }

  @page journal-a5 {
    size: A5 portrait;
    margin: 8mm;
  }

  @page {
    size: A4 portrait;
    margin: 14mm;
  }

  body.journal-print-a4 { page: journal-a4; }
  body.journal-print-a5 { page: journal-a5; }

  body {
    padding: 0 !important;
    background: #fff !important;
    color: #111827 !important;
  }

  .navbar,
  .acc-sidebar,
  .acc-mobile-menu-btn,
  .acc-sidebar-backdrop,
  .voucher-header,
  .card-header button,
  .btn,
  button,
  #journalArchivePanel,
  .account-picker-results,
  .account-picker-btn,
  .btn-del,
  .custom-success-toast {
    display: none !important;
  }

  .app-wrapper,
  .app-content {
    display: block !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .container-fluid.py-3 {
    max-width: none !important;
    padding: 0 !important;
  }

  .voucher-print-head {
    display: flex !important;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1.5px solid #0f172a;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc, #eef2ff) !important;
    box-shadow: none !important;
  }

  .voucher-print-brand {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .voucher-print-brand img {
    width: 64px;
    height: 64px;
    object-fit: contain;
  }

  .voucher-print-brand h2 {
    margin: 0;
    color: #0f172a;
    font-size: 20px;
    font-weight: 900;
  }

  .voucher-print-brand p {
    margin: 4px 0 0;
    color: #111827;
    font-size: 16px;
    font-weight: 900;
  }

  .voucher-print-meta {
    display: grid;
    gap: 5px;
    color: #334155;
    font-size: 12px;
    text-align: end;
  }

  .voucher-print-meta span {
    padding: 5px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff !important;
  }

  .card-3d,
  .modern-voucher-card,
  .totals-card {
    border: 1.2px solid #0f172a !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    margin-bottom: 12px !important;
    break-inside: avoid;
  }

  .card-3d:hover,
  .modern-voucher-card:hover {
    transform: none !important;
  }

  .totals-fixed {
    position: static !important;
    padding: 12px !important;
  }

  .journal-grid {
    min-width: 0 !important;
    border-collapse: collapse !important;
    font-size: 12px;
  }

  .journal-grid th,
  .journal-grid td {
    padding: 7px 8px !important;
    border: 1px solid #334155 !important;
  }

  .journal-grid thead th {
    background: #e5e7eb !important;
    color: #111827 !important;
    font-weight: 900;
  }

  .form-control,
  .form-select {
    border: 0 !important;
    padding-inline: 0 !important;
    min-height: 0 !important;
    background: transparent !important;
    color: #111827 !important;
  }

  .voucher-print-signatures {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 28px;
    break-inside: avoid;
  }

  .voucher-print-signatures div {
    min-height: 58px;
    padding-top: 8px;
    border-top: 1.5px solid #111827;
    text-align: center;
  }

  .voucher-print-signatures span {
    display: block;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
  }

  .voucher-print-signatures strong {
    display: block;
    margin-top: 20px;
  }

  body.journal-print-a5 .voucher-print-head {
    padding: 9px 10px;
    margin-bottom: 10px;
  }

  body.journal-print-a5 .voucher-print-brand img {
    width: 46px;
    height: 46px;
  }

  body.journal-print-a5 .voucher-print-brand h2 {
    font-size: 15px;
  }

  body.journal-print-a5 .voucher-print-brand p,
  body.journal-print-a5 .voucher-print-meta {
    font-size: 10px;
  }

  body.journal-print-a5 .journal-grid {
    font-size: 10px;
  }

  body.journal-print-a5 .journal-grid th,
  body.journal-print-a5 .journal-grid td {
    padding: 4px 5px !important;
  }

  body.journal-print-a5 .voucher-print-signatures {
      gap: 8px;
      margin-top: 18px;
    }
}
