:root {
  --app-bg-1: #f8fafc;
  --app-bg-2: #eef3f9;
  --app-border: #dde5f0;
  --app-title: #0f172a;
  --app-muted: #64748b;
  --app-kpi: #0b2f58;
}

body.app-body {
  background: linear-gradient(160deg, var(--app-bg-1) 0%, var(--app-bg-2) 100%);
  min-height: 100vh;
}

.app-nav-card {
  position: sticky;
  top: 1.25rem;
}

.app-nav-card .list-group-item {
  border: 0;
  border-radius: 0.5rem;
  margin: 0.2rem;
  font-weight: 500;
}

.app-view .card {
  border: 1px solid var(--app-border);
}

.kpi-card {
  border-left: 4px solid #1d4ed8;
}

.kpi-title {
  color: var(--app-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  color: var(--app-kpi);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0.4rem;
}

.table-responsive {
  border-top: 1px solid var(--app-border);
}

.table > :not(caption) > * > * {
  vertical-align: middle;
}

.entity-actions {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}

.entity-actions .fa-solid {
  font-size: 2em;
  line-height: 1;
}

.is-required::after {
  content: " *";
  color: #b91c1c;
  font-weight: 700;
}

.required-indicator {
  color: #b91c1c;
  font-weight: 700;
}

.field-error {
  font-size: 0.82rem;
  line-height: 1.3;
}

.table td .field-error {
  margin-top: 0.2rem;
}

.form-control.is-invalid,
.form-select.is-invalid,
.form-check-input.is-invalid {
  border-color: #dc3545;
}

select.is-invalid + .ts-wrapper .ts-control {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.ts-wrapper.form-select,
.ts-wrapper.form-select-sm {
  padding: 0;
  border: 0;
  background: transparent;
  background-image: none;
  box-shadow: none;
  height: auto;
  min-height: 0;
}

.ts-dropdown {
  z-index: 2000;
}

.invoice-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.invoice-item-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.invoice-item-entry {
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.75rem;
}

.invoice-item-entry .ts-wrapper {
  width: 100%;
}

.invoice-item-entry .field-error {
  margin-top: 0.2rem;
}

.invoice-item-input-short {
  width: 8ch;
  min-width: 8ch;
}

.invoice-item-input-discount {
  width: 8ch;
  min-width: 8ch;
}

.invoice-item-input-price {
  width: 15ch;
  min-width: 15ch;
}

.invoice-item-description-input {
  min-height: 5.25rem;
}

.app-floating-alert {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 12000;
  max-width: min(32rem, calc(100vw - 2rem));
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
}

.invoice-print-sheet {
  border: 0;
}

.invoice-print-headline {
  font-size: 1.35rem;
  font-weight: 700;
}

.invoice-print-meta {
  color: var(--app-muted);
  font-size: 0.9rem;
}

.invoice-print-table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invoice-print-total {
  font-size: 1.05rem;
  font-weight: 700;
}

@media (max-width: 991.98px) {
  .app-nav-card {
    position: static;
  }

  .kpi-value {
    font-size: 1.35rem;
  }
}

@media print {
  body.print-invoice-mode nav,
  body.print-invoice-mode .app-shell,
  body.print-invoice-mode .modal-backdrop,
  body.print-invoice-mode #entity-modal,
  body.print-invoice-mode #invoice-modal {
    display: none !important;
  }

  body.print-invoice-mode #invoice-print-modal {
    display: block !important;
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  body.print-invoice-mode #invoice-print-modal .modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    transform: none !important;
  }

  body.print-invoice-mode #invoice-print-modal .modal-content {
    border: 0 !important;
    box-shadow: none !important;
  }

  body.print-invoice-mode #invoice-print-modal .no-print {
    display: none !important;
  }
}
