/* Payment voucher — live entry on A4 sheet */
body.voucher-live-entry {
  background: #e8ebf0;
}

.voucher-live-layout {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
}

.voucher-live-layout .editor {
  display: none !important;
}

.voucher-live-toolbar {
  position: sticky;
  top: 56px;
  z-index: 90;
  background: #fff;
  border-bottom: 1px solid #e2e5eb;
  box-shadow: 0 4px 20px rgba(15, 20, 25, 0.06);
}

.voucher-live-toolbar__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 10px 20px;
}

.voucher-live-toolbar__row--tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 20px;
  row-gap: 6px;
  padding: 12px 20px 14px;
  background: #f8f9fb;
}

.voucher-live-toolbar__fields {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px 16px;
  min-width: 0;
}

.voucher-live-toolbar__actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  min-width: 280px;
  padding-left: 20px;
  border-left: 1px solid #e2e5eb;
  align-self: stretch;
}

.voucher-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.voucher-toolbar-field__label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b7280;
  line-height: 1;
  white-space: nowrap;
}

.voucher-toolbar-field__inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}

.voucher-toolbar-field--customer .voucher-toolbar-control {
  width: 220px;
}

.voucher-toolbar-field--ref .voucher-toolbar-control {
  width: 168px;
}

.voucher-toolbar-control {
  box-sizing: border-box;
  width: 100%;
  min-height: 36px;
  padding: 0 0.65rem;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  font: inherit;
  font-size: 0.8125rem;
  color: #0f1419;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.voucher-toolbar-control:hover {
  border-color: #c5ccd6;
}

.voucher-toolbar-control:focus {
  outline: none;
  border-color: #9aa3ad;
  box-shadow: 0 0 0 3px rgba(15, 20, 25, 0.06);
}

.voucher-toolbar-tip {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  padding-left: 2px;
  font-size: 0.72rem;
  color: #6b7280;
  line-height: 1.4;
  max-width: 52rem;
}

.voucher-toolbar-btn-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}

.voucher-live-toolbar .btn {
  min-height: 36px;
  width: auto;
  padding: 0.45rem 0.9rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.voucher-live-toolbar .btn-toolbar {
  min-height: 36px;
  padding: 0.45rem 0.85rem;
}

.voucher-live-toolbar .btn-primary {
  min-width: 88px;
}

.voucher-preview-wrap {
  flex: 1;
  width: 100%;
  padding: 24px 32px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, #e8ebf0 0%, #dfe3ea 100%);
}

.voucher-live-canvas {
  width: 100%;
  max-width: min(1200px, 96vw);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.voucher-live-sheet {
  width: 210mm;
  min-height: 297mm;
  box-shadow: 0 8px 40px rgba(15, 20, 25, 0.12);
}

.voucher-live-entry .v-live-input,
.voucher-live-entry .v-live-select,
.voucher-live-entry .v-live-textarea {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 2px 4px;
  font: inherit;
  font-size: inherit;
  color: #0a0a0a;
  box-sizing: border-box;
  border: none;
  border-radius: 2px;
  background: transparent;
}

.voucher-live-entry .v-live-input:hover,
.voucher-live-entry .v-live-select:hover,
.voucher-live-entry .v-live-textarea:hover {
  background: #f6f7f9;
}

.voucher-live-entry .v-live-input:focus,
.voucher-live-entry .v-live-select:focus,
.voucher-live-entry .v-live-textarea:focus {
  outline: 1px solid #c8cdd6;
  background: #f3f4f6;
}

.voucher-live-entry .v-live-customer {
  flex: 1;
  min-width: 120px;
  font-weight: 700;
  text-transform: uppercase;
}

.voucher-live-entry .v-live-date {
  width: auto;
  min-width: 130px;
}

.voucher-live-entry .inv-info-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.voucher-live-entry .inv-info-row .v-live-input,
.voucher-live-entry .inv-info-row .v-live-select {
  flex: 1;
  min-width: 120px;
}

.voucher-live-entry .items-table--live {
  table-layout: fixed;
  width: 100%;
}

.voucher-live-entry .items-table--live th,
.voucher-live-entry .items-table--live td {
  vertical-align: middle;
}

.voucher-live-entry .items-table--live input.v-live-input,
.voucher-live-entry .items-table--live select.v-live-select {
  width: 100%;
  font-size: 0.78rem;
}

.voucher-live-entry .items-table--live input.v-live-amount {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.voucher-live-entry .items-table--live tr.v-live-row:focus-within {
  background: #f8f9fb;
}

.voucher-live-entry .v-live-money {
  width: 88px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.voucher-live-entry .v-live-textarea {
  min-height: 48px;
  resize: vertical;
  line-height: 1.4;
}

.voucher-live-entry .payment-note-block .v-live-textarea {
  margin-top: 4px;
}

.voucher-live-entry .stamp-seal {
  width: 150px;
  height: 150px;
}

.voucher-toolbar-field--layout .voucher-toolbar-field__inline {
  min-height: 36px;
}

.voucher-toolbar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.voucher-toolbar-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
}

.voucher-row-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #475569;
  background: #eef2f7;
  border: 1px solid #d8dde6;
  white-space: nowrap;
}

.voucher-line-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 0 4px;
}

.voucher-line-actions .field-hint {
  font-size: 0.72rem;
  color: #6b7280;
}

.voucher-live-entry .items-table--live .col-remove {
  width: 36px;
  text-align: center;
  padding-inline: 2px;
}

.v-line-remove {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #d8dde6;
  border-radius: 6px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.v-line-remove:hover {
  color: #c41e24;
  border-color: #ee1c25;
  background: #fff5f5;
}

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

.voucher-search-table th,
.voucher-search-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #e2e5eb;
  text-align: left;
}

.voucher-search-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5c6570;
}

.voucher-search-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.voucher-search-table .v-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.voucher-live-entry .isf-body {
  padding-left: 0;
}

.voucher-import-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 300;
  width: min(420px, 96vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid #e2e5eb;
  box-shadow: -8px 0 32px rgba(15, 20, 25, 0.12);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.voucher-import-drawer.is-open {
  transform: translateX(0);
}

.voucher-import-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #eef0f4;
}

.voucher-import-drawer__body {
  flex: 1;
  overflow: auto;
  padding: 16px 18px 24px;
}

.voucher-import-backdrop {
  position: fixed;
  inset: 0;
  z-index: 290;
  background: rgba(15, 20, 25, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.voucher-import-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .voucher-preview-wrap {
    padding: 16px 12px 32px;
  }

  .voucher-live-toolbar__row--tools {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding-inline: 12px;
  }

  .voucher-live-toolbar__fields {
    grid-column: 1;
    grid-row: auto;
  }

  .voucher-toolbar-tip {
    grid-column: 1;
    grid-row: auto;
  }

  .voucher-live-toolbar__actions {
    grid-column: 1;
    grid-row: auto;
    min-width: 0;
    width: 100%;
    padding-left: 0;
    padding-top: 10px;
    border-left: none;
    border-top: 1px solid #e2e5eb;
    align-items: stretch;
    align-self: auto;
  }

  .voucher-toolbar-btn-row {
    justify-content: flex-start;
  }

  .voucher-toolbar-field--customer .voucher-toolbar-control,
  .voucher-toolbar-field--ref .voucher-toolbar-control {
    width: 100%;
    min-width: 0;
  }

  .voucher-live-sheet {
    width: 100%;
    min-width: 0;
  }
}

@media print {
  .voucher-live-toolbar,
  .voucher-import-drawer,
  .voucher-import-backdrop,
  .preview-label,
  .no-print {
    display: none !important;
  }

  .voucher-preview-wrap {
    padding: 0;
    background: #fff;
  }

  .voucher-live-entry .items-table--live .col-remove,
  .v-line-remove {
    display: none !important;
  }

  .voucher-live-entry .v-live-input,
  .voucher-live-entry .v-live-select,
  .voucher-live-entry .v-live-textarea {
    border: none !important;
    background: transparent !important;
  }
}
