html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
  margin: 0;
  color: #172033;
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 35%),
    linear-gradient(145deg, #f8fafc 0%, #e0e7ff 100%);
}

.login-brand-mark {
  width: 3.25rem;
  height: 3.25rem;
  color: #fff;
  background: #1d4ed8;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  --bs-offcanvas-width: 270px;
  width: 270px;
  background: linear-gradient(180deg, #111827 0%, #172554 100%);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
}

.app-brand:hover {
  color: #fff;
}

.app-brand small {
  display: block;
  color: #aab6d3;
  font-size: 0.75rem;
}

.app-brand-mark,
.app-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  font-weight: 700;
}

.app-card-icon svg { display: block; width: 1.5rem; height: 1.5rem; }

.app-brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  color: #172554;
  background: #fff;
}

.app-nav-section {
  margin: 1.5rem 0.75rem 0.5rem;
  color: #8492b4;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.65rem;
  color: #c8d1e8;
  text-decoration: none;
}

.app-nav-link:hover,
.app-nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.app-nav-link.is-disabled {
  cursor: default;
  opacity: 0.64;
}

.app-nav-badge {
  display: inline-flex;
  width: 1.6rem;
  height: 1.6rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.45rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  font-size: 0.72rem;
  font-weight: 700;
}

.app-sidebar-note {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  color: #dce4f6;
  font-size: 0.78rem;
}

.app-sidebar-note span {
  color: #9aa8c8;
}

.app-content {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
}

.app-main {
  flex: 1;
  padding: 1.5rem;
}

.app-footer {
  padding: 1rem 1.5rem;
  background: #fff;
  font-size: 0.85rem;
}

.app-card-icon {
  min-width: 2.6rem;
  height: 2.6rem;
  padding: 0 0.7rem;
  color: #1d4ed8;
  background: #dbeafe;
}

code {
  color: #9f1239;
}

@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
  }
}

@media (max-width: 575.98px) {
  .app-topbar,
  .app-main,
  .app-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.app-brand-logo {
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  border-radius: 0.65rem;
  object-fit: contain;
  background: #fff;
}

.login-brand-logo {
  width: 7rem;
  height: 7rem;
  border-radius: 1rem;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 0.75rem 2rem rgba(23, 32, 51, 0.14);
}

.build-health-scale {
  display: grid;
  grid-template-columns: repeat(3, minmax(4.5rem, 1fr));
  gap: 0.35rem;
}

.build-health-segment {
  padding: 0.55rem 0.35rem;
  border-radius: 0.4rem;
  color: #fff;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.22;
}

.build-health-red { background: #dc3545; }
.build-health-orange { background: #fd7e14; }
.build-health-green { background: #198754; }

.build-health-blocked .build-health-red,
.build-health-review .build-health-orange,
.build-health-ready .build-health-green {
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.14);
}

.build-health-unknown .build-health-segment {
  opacity: 0.4;
}


/* Shared responsive screen layout. Print documents use their own isolated styles. */
@media screen {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  body {
    overflow-x: hidden;
  }

  img,
  svg {
    max-width: 100%;
  }

  .app-shell,
  .app-content,
  .app-main,
  .row > * {
    min-width: 0;
  }

  .app-main {
    overflow-x: clip;
  }

  .app-sidebar .offcanvas-body {
    overflow-y: auto;
  }

  .app-sidebar-account {
    padding-top: 1rem;
  }

  .app-topbar-brand,
  .app-topbar-actions {
    min-width: 0;
  }

  .app-topbar-brand strong,
  .text-break-mobile,
  .card-title,
  td,
  th,
  .alert,
  .badge {
    overflow-wrap: anywhere;
  }

  .table-responsive {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive > .table {
    margin-bottom: 0;
  }

  .table-responsive th,
  .table-responsive td {
    vertical-align: middle;
  }

  .form-control,
  .form-select,
  .input-group,
  textarea {
    max-width: 100%;
  }

  .validation-summary-errors,
  .field-validation-error {
    overflow-wrap: anywhere;
  }

  .modal-dialog {
    max-width: calc(100% - 1rem);
    margin-right: auto;
    margin-left: auto;
  }

  .modal-content {
    max-height: calc(100dvh - 1rem);
  }

  .modal-body {
    overflow-y: auto;
  }

  .responsive-actions,
  .report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
  }

  .responsive-upload-preview {
    width: 11.25rem;
    max-width: 100%;
    height: 8.75rem;
    object-fit: contain;
  }

  .stock-part-thumbnail {
    width: 6rem;
    height: 4.75rem;
    flex: 0 0 auto;
    object-fit: contain;
  }
  .responsive-media-preview {
    width: min(100%, 26rem);
    height: auto;
    object-fit: contain;
  }

  .approval-form {
    width: min(100%, 26rem);
  }

  .pre-line {
    white-space: pre-line;
  }

  /* PC Builder screen classes only; no selection/calculation behavior is changed. */
  .builder-template-list {
    display: flex;
    gap: .75rem;
    overflow-x: auto;
    padding: .25rem .1rem .75rem;
    scroll-snap-type: x proximity;
  }

  .approval-form textarea {
    width: 100%;
  }

  .builder-template-card {
    width: 13.75rem;
    max-width: 82vw;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .builder-template-image {
    width: 100%;
    height: 7.25rem;
    object-fit: contain;
  }

  .builder-sticky {
    position: sticky;
    top: 1rem;
  }

  .selected-part-image {
    width: 100%;
    height: 9.375rem;
    object-fit: contain;
  }

  .builder-part-name,
  .builder-part-specification,
  .builder-warning {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .builder-loading-indicator {
    max-width: min(24rem, calc(100vw - 2rem));
    white-space: normal;
  }

  .builder-image-modal {
    max-height: 70dvh;
    object-fit: contain;
  }
}

@media screen and (max-width: 991.98px) {
  .app-sidebar {
    --bs-offcanvas-width: min(86vw, 280px);
    width: min(86vw, 280px);
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
  }

  .builder-sticky {
    position: static;
  }

  .builder-summary-column {
    margin-top: 1rem;
  }
}

@media screen and (max-width: 767.98px) {
  html {
    font-size: 16px;
  }

  .app-topbar {
    min-height: 60px;
    gap: .75rem;
    padding-top: .5rem;
    padding-bottom: .5rem;
  }

  .app-topbar > .btn {
    min-width: 44px;
    min-height: 44px;
  }

  .app-topbar-brand .small {
    display: none !important;
  }

  .app-topbar-brand strong {
    display: block;
    max-width: calc(100vw - 5.75rem);
    font-size: .9rem;
  }

  .app-main {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .app-footer {
    text-align: center;
  }

  .form-control,
  .form-select,
  .btn:not(.btn-close),
  .input-group-text {
    min-height: 44px;
  }

  .btn-group,
  .responsive-actions,
  .report-actions {
    width: 100%;
  }

  .responsive-actions > .btn,
  .responsive-actions > form,
  .report-actions > .btn,
  .report-actions > form {
    flex: 1 1 10rem;
  }

  .responsive-actions > form > .btn,
  .report-actions > form > .btn {
    width: 100%;
  }

  .card-body,
  .card-header,
  .card-footer {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  /* Important document lists become readable cards instead of tiny tables. */
  .mobile-record-table,
  .mobile-record-table tbody,
  .mobile-record-table tr,
  .mobile-record-table td {
    display: block;
    width: 100%;
  }

  .mobile-record-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .mobile-record-table tbody {
    display: grid;
    gap: .75rem;
  }

  .mobile-record-table tbody tr {
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    background: var(--bs-body-bg);
    box-shadow: 0 .15rem .5rem rgba(23, 32, 51, .06);
  }

  .mobile-record-table tbody td {
    display: grid;
    grid-template-columns: minmax(6.25rem, 36%) minmax(0, 1fr);
    gap: .75rem;
    align-items: start;
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--bs-border-color);
    text-align: left !important;
  }

  .mobile-record-table tbody td::before {
    content: attr(data-label);
    color: var(--bs-secondary-color);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .mobile-record-table tbody td:last-child {
    border-bottom: 0;
  }

  .mobile-record-table .mobile-record-primary {
    display: block;
    padding-top: .85rem;
    background: var(--bs-tertiary-bg);
  }

  .mobile-record-table .mobile-record-primary::before,
  .mobile-record-table .mobile-record-empty::before {
    content: none;
  }

  .mobile-record-table .mobile-record-actions {
    display: block;
  }

  .mobile-record-table .mobile-record-actions::before {
    content: none;
  }

  .mobile-record-table .mobile-record-actions .btn {
    width: 100%;
  }

  .mobile-record-table .mobile-record-empty {
    display: block;
    padding: 1rem;
    text-align: center !important;
  }

  .approval-form textarea {
    width: 100%;
  }

  .quotation-warning-row {
    flex-direction: column;
  }

  .quotation-warning-row > * {
    width: 100%;
    text-align: left !important;
  }

  .login-page main.container {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  .approval-form {
    width: 100%;
  }

  .builder-main-card > .card-body {
    padding: 1rem !important;
  }

  .health-scale {
    grid-template-columns: 1fr;
  }

  .builder-template-card {
    width: min(17rem, 82vw);
  }

  .selected-parts-grid > [class*="col-"] {
    width: 100%;
  }

  .selected-part-image {
    height: 11rem;
  }

  .build-health-scale {
    grid-template-columns: 1fr;
  }

  .build-health-segment {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .builder-control-row > [class*="col-"] {
    width: 100%;
  }
}

@media screen and (max-width: 575.98px) {
  .app-topbar,
  .app-main,
  .app-footer {
    padding-right: .75rem;
    padding-left: .75rem;
  }

  h1,
  .h1 {
    font-size: clamp(1.6rem, 8vw, 2rem);
  }

  h2,
  .h2 {
    font-size: clamp(1.35rem, 7vw, 1.75rem);
  }

  .app-main > .d-flex.flex-wrap:first-child,
  .app-main > .d-flex.justify-content-between:first-child {
    align-items: stretch !important;
    gap: .75rem !important;
  }

  .app-main > .d-flex.flex-wrap:first-child > *,
  .app-main > .d-flex.justify-content-between:first-child > * {
    max-width: 100%;
  }

  .modal-dialog {
    max-width: calc(100% - .5rem);
    margin: .25rem auto;
  }

  .modal-content {
    max-height: calc(100dvh - .5rem);
  }
}
/* Full Paid Sales office report. This does not affect quotation or invoice print views. */
.full-paid-report .report-print-header,
.full-paid-report .report-print-summary,
.full-paid-report .report-print-footer {
  display: none;
}

@media print {
  @page fullPaidSales {
    size: A4 landscape;
    margin: 12mm;
  }

  body.full-paid-sales-report-page {
    background: #fff !important;
    color: #172033;
    font-family: Arial, sans-serif;
    font-size: 10pt;
  }

  body.full-paid-sales-report-page .app-shell,
  body.full-paid-sales-report-page .app-content {
    display: block;
    min-height: 0;
  }

  body.full-paid-sales-report-page .app-sidebar,
  body.full-paid-sales-report-page .app-topbar,
  body.full-paid-sales-report-page .app-footer {
    display: none !important;
  }

  body.full-paid-sales-report-page .app-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .full-paid-report {
    page: fullPaidSales;
  }

  .full-paid-report .report-print-header {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 8mm;
    padding-bottom: 4mm;
    border-bottom: 2px solid #184b7a;
  }

  .report-print-letterhead {
    display: flex;
    align-items: center;
    gap: 4mm;
  }

  .report-print-logo {
    width: 18mm;
    height: 18mm;
    object-fit: contain;
  }

  .report-print-company {
    color: #184b7a;
    font-size: 19pt;
    font-weight: 800;
    letter-spacing: .02em;
  }

  .report-print-subtitle {
    font-size: 10pt;
    font-weight: 600;
  }

  .report-print-title-block {
    min-width: 86mm;
    text-align: right;
    line-height: 1.5;
  }

  .report-print-title-block h1 {
    margin: 0 0 2mm;
    color: #184b7a;
    font-size: 17pt;
    letter-spacing: .08em;
  }

  .full-paid-report .report-print-summary {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5mm;
    margin-bottom: 5mm;
  }

  .report-print-summary > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3mm 4mm;
    border: 1px solid #b7c6d5;
    background: #eef4f9 !important;
    print-color-adjust: exact;
  }

  .report-print-summary span {
    color: #4f5f70;
    text-transform: uppercase;
    letter-spacing: .05em;
  }

  .report-print-summary strong {
    font-size: 13pt;
  }

  .full-paid-report .report-print-table {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .full-paid-report .report-print-table .card-header {
    padding: 0 0 2mm;
    border: 0;
    background: transparent;
  }

  .full-paid-report .report-print-table .table-responsive {
    overflow: visible;
  }

  .full-paid-report .report-print-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
  }

  .full-paid-report .report-print-table thead {
    display: table-header-group;
  }

  .full-paid-report .report-print-table tr {
    break-inside: avoid;
  }

  .full-paid-report .report-print-table th,
  .full-paid-report .report-print-table td {
    padding: 2.2mm;
    border: 1px solid #bcc7d2;
    background: #fff;
    vertical-align: top;
  }

  .full-paid-report .report-print-table thead th {
    color: #fff;
    background: #184b7a !important;
    print-color-adjust: exact;
  }

  .full-paid-report .report-print-table tfoot th {
    background: #e6eef6 !important;
    font-size: 9.5pt;
    print-color-adjust: exact;
  }

  .full-paid-report .report-print-footer {
    display: flex !important;
    justify-content: flex-end;
    gap: 28mm;
    margin-top: 16mm;
    text-align: center;
    break-inside: avoid;
  }

  .report-print-footer > div {
    width: 55mm;
    padding-top: 2mm;
    border-top: 1px solid #53606d;
    font-weight: 700;
  }

  .report-print-footer span {
    color: #66717d;
    font-size: 8pt;
    font-weight: 400;
  }
}
.audit-json {
  max-height: 16rem;
  margin: 0;
  padding: .75rem;
  overflow: auto;
  border-radius: .5rem;
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  font-size: .78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media screen and (max-width: 767.98px) {
  form[action*="/void"] {
    width: 100%;
    flex-wrap: wrap;
  }

  form[action*="/void"] .form-control,
  form[action*="/void"] .btn {
    width: 100%;
  }
}