/*
  ILC Bootstrap theme
  Adapted from Settlement Hub's operations styling.
*/

:root {
  --ops-red: #cc0000;
  --ops-red-dark: #8b0000;
  --ops-gold: #f5a800;
  --ops-gold-soft: #fff3d6;
  --ops-ink: #1a1a1a;
  --ops-muted: #6c757d;
  --ops-border: #dfdfdf;
  --ops-bg-top: #ececec;
  --ops-bg-bottom: #dddddd;
  --ops-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
  --ops-shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.12);
  --ops-radius: 1.15rem;
  --ops-radius-sm: 0.9rem;
  --bs-primary: var(--ops-red);
  --bs-primary-rgb: 204, 0, 0;
  --bs-secondary: var(--ops-ink);
  --bs-secondary-rgb: 26, 26, 26;
  --bs-warning: var(--ops-gold);
  --bs-warning-rgb: 245, 168, 0;
  --bs-danger: var(--ops-red);
  --bs-danger-rgb: 204, 0, 0;
  --bs-body-color: var(--ops-ink);
  --bs-body-bg: #e6e6e6;
  --bs-border-color: var(--ops-border);
  --bs-link-color: var(--ops-red);
  --bs-link-hover-color: var(--ops-red-dark);
  --bs-btn-border-radius: 0.85rem;
  --bs-btn-font-weight: 700;
  --bs-form-control-border-radius: 0.85rem;
  --bs-form-select-border-radius: 0.85rem;
  --bs-focus-ring-color: rgba(204, 0, 0, 0.16);
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Barlow", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(245, 168, 0, 0.08), transparent 28%),
    linear-gradient(180deg, var(--ops-bg-top) 0%, var(--ops-bg-bottom) 100%);
}

h1, h2, h3, h4, h5, h6,
.font-condensed {
  font-family: "Barlow Condensed", sans-serif;
}

.btn {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-primary {
  background: linear-gradient(90deg, var(--ops-red-dark), var(--ops-red));
  border-color: var(--ops-red-dark);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background: linear-gradient(90deg, #760000, #b40000);
  border-color: #760000;
}

.form-control,
.form-select {
  min-height: 48px;
  background-color: #fff;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: rgba(204, 0, 0, 0.4);
  box-shadow: 0 0 0 0.25rem rgba(204, 0, 0, 0.12);
}

.table thead th {
  color: var(--ops-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.modal-content {
  border: 0;
  border-radius: 1rem;
  box-shadow: var(--ops-shadow);
}

.credit-file-preview-list {
  display: grid;
  gap: 0.5rem;
}

.credit-file-preview-list-grid {
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.credit-file-preview {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid var(--ops-border);
  border-radius: 0.5rem;
  background: #fff;
}

.credit-file-preview > .min-w-0,
.credit-file-preview a.min-w-0,
.credit-file-preview .flex-grow-1 {
  min-width: 0;
}

.credit-file-preview .text-truncate {
  max-width: 100%;
}

.credit-file-preview:hover {
  border-color: rgba(204, 0, 0, 0.35);
  background: #fffafa;
}

.credit-file-preview.is-marked-delete {
  opacity: 0.58;
  background: #f8f9fa;
}

.credit-file-preview.is-marked-delete .credit-file-thumb,
.credit-file-preview.is-marked-delete .fw-semibold {
  filter: grayscale(1);
  text-decoration: line-through;
}

.credit-file-thumb {
  width: 3rem;
  height: 3rem;
  flex: 0 0 3rem;
  object-fit: cover;
  border-radius: 0.45rem;
  border: 1px solid var(--ops-border);
  background: #f8f9fa;
}

.credit-file-thumb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ops-red);
  font-size: 1.45rem;
}

.swal2-container {
  z-index: 2100 !important;
}

.ops-topbar {
  background: linear-gradient(90deg, var(--ops-red-dark), var(--ops-red));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.ops-brand,
.ops-brand:hover {
  color: #fff;
  text-decoration: none;
}

.ops-brand-mark {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ops-gold);
  color: var(--ops-ink);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.ops-brand-title {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ops-brand-subtitle {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  line-height: 1.1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ops-topbar-tools,
.ops-topbar-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dashboard-card,
.auth-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-top: 5px solid var(--ops-red);
  border-radius: var(--ops-radius);
  box-shadow: var(--ops-shadow);
  overflow: hidden;
}

.ops-stat-card,
.ops-panel {
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--ops-radius-sm);
  background: #ffffff;
  box-shadow: var(--ops-shadow-soft);
}

.ops-stat-label,
.ops-panel-title,
.ops-form-label {
  color: var(--ops-red);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-eyebrow,
.auth-eyebrow {
  color: var(--ops-red);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-title,
.auth-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.page-copy,
.auth-copy {
  color: var(--ops-muted);
  font-size: 1rem;
}

.auth-wrap {
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 30rem;
}

.auth-card.wide {
  max-width: 36rem;
}

.auth-card-body {
  padding: 2rem;
}

.auth-links a {
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--ops-muted);
  padding: 0;
}

#globalFlashContainer {
  position: fixed;
  top: 5rem;
  left: 0;
  right: 0;
  z-index: 1085;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
  pointer-events: none;
}

#globalFlashContainer .alert {
  width: min(42rem, 100%);
  border: 0;
  box-shadow: var(--ops-shadow-soft);
  pointer-events: auto;
}

.flash-inner {
  display: inline-flex;
  flex-direction: column;
  width: 100%;
}

.flash-progress {
  margin-top: 0.35rem;
  height: 3px;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  overflow: hidden;
}

.flash-progress-bar {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.25);
  transition: width 0.1s linear;
}

.flash-fade {
  transition: opacity 0.6s ease;
  opacity: 0;
}

.work-order-dt-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.75rem;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

#workOrdersTable thead th {
  position: sticky;
  top: 84px;
  z-index: 20;
  background: #e9ecef;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.work-order-toolbar-row,
.work-order-custom-controls,
.work-order-filters-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.work-order-native-row {
  justify-content: space-between;
}

.work-order-custom-controls {
  justify-content: flex-end;
  flex: 1 1 auto;
}

.work-order-dt-toolbar .dataTables_filter {
  margin-left: auto;
}

.work-order-filters-right {
  justify-content: flex-end;
  margin-left: auto;
}

.work-order-dt-toolbar .dataTables_length,
.work-order-dt-toolbar .dataTables_filter,
.work-order-dt-toolbar .dataTables_length label,
.work-order-dt-toolbar .dataTables_filter label,
.work-order-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  flex: 0 0 auto;
}

.work-order-dt-toolbar .dataTables_length label,
.work-order-dt-toolbar .dataTables_filter label {
  font-size: 0.86rem;
  color: var(--ops-ink);
}

.work-order-dt-toolbar .form-select,
.work-order-dt-toolbar .form-control,
.work-order-dt-toolbar .form-select-sm,
.work-order-dt-toolbar .form-control-sm,
.work-order-dt-toolbar .dataTables_length select,
.work-order-dt-toolbar .dataTables_filter input {
  min-height: 0;
}

.work-order-dt-toolbar .dataTables_length select {
  width: auto;
}

.work-order-dt-toolbar #vendorFilter {
  width: 8.5rem !important;
}

.work-order-dt-toolbar #invoiceDateFilter {
  width: 9.5rem !important;
}

.work-order-dt-toolbar #invoiceTypeFilter {
  width: 10rem !important;
}

.work-order-dt-toolbar .dataTables_filter input {
  width: 12rem;
  margin-left: 0.45rem;
}

.ops-toolbar-label {
  color: var(--ops-red);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

#workOrdersTable .form-check-input {
  cursor: pointer;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--ops-muted);
}

#workOrdersTable .form-check-input:checked {
  background-color: var(--ops-red);
  border-color: var(--ops-red);
}

.work-order-select-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.work-order-select-all .form-check-input {
  width: 1rem;
  height: 1rem;
  background-color: #ffffff;
  border: 2px solid var(--ops-muted);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.work-order-select-all .form-check-input:checked {
  background-color: var(--ops-red);
  border-color: var(--ops-red);
}

.work-order-floating-actions {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.6rem);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.work-order-floating-actions.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.work-order-floating-count {
  color: var(--ops-muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.work-order-table-responsive {
  overflow-x: visible;
}

@media (max-width: 991.98px) {
  .table-responsive {
    overflow: visible;
  }

  .ops-mobile-table thead {
    display: none;
  }

  .work-order-dt-toolbar {
    position: static;
    box-shadow: none;
  }

  .work-order-dt-toolbar .dataTables_filter {
    margin-left: 0;
  }

  .work-order-floating-actions {
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    justify-content: center;
    border-radius: 0.9rem;
    transform: translateY(0.6rem);
  }

  .work-order-floating-actions.is-visible {
    transform: translateY(0);
  }

  .ops-mobile-table,
  .ops-mobile-table tbody,
  .ops-mobile-table tr,
  .ops-mobile-table td,
  .ops-mobile-table th {
    display: block;
    width: 100%;
  }

  .ops-mobile-table tbody {
    display: grid;
    gap: 0.85rem;
  }

  .ops-mobile-table tbody tr {
    border: 1px solid rgba(27, 27, 27, 0.08);
    border-radius: 1rem;
    padding: 1rem;
    background: #ffffff;
    box-shadow: 0 0.6rem 1.5rem rgba(17, 17, 17, 0.06);
  }

  .ops-mobile-table tbody td {
    display: grid;
    grid-template-columns: minmax(92px, 112px) minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    border: 0;
    padding: 0.45rem 0;
    text-align: left !important;
    white-space: normal !important;
  }

  .ops-mobile-table tbody td::before {
    content: attr(data-label);
    color: var(--ops-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .ops-mobile-table tbody td[data-label=""] {
    grid-template-columns: 1fr;
  }

  .ops-mobile-table tbody td[data-label=""]::before {
    display: none;
  }
}

/* Disputed table — child row expand */
#disputesTable td.dt-control {
  cursor: pointer;
  color: var(--ops-muted);
  width: 2rem;
  text-align: center;
}

#disputesTable tr.dt-row-open > td.dt-control {
  color: var(--ops-red);
}

.dt-chevron {
  font-size: 0.75rem;
  display: inline-block;
  transition: transform 0.18s ease;
}

.dispute-child-wrapper > td {
  padding: 0 !important;
  background-color: #f8f9fa !important;
  border-top: none !important;
}

.dispute-child-row {
  border-top: 3px solid var(--ops-gold);
}

@media (max-width: 575.98px) {
  .ops-brand-title {
    font-size: 1.1rem;
  }

  .ops-brand-subtitle {
    font-size: 0.63rem;
  }

  .auth-card-body {
    padding: 1.5rem;
  }
}

.ops-stat-card-hover {
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease;
}
.ops-stat-card-hover:hover,
.ops-stat-card-hover:focus {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  transform: translateY(-1px);
  outline: none;
}
.ops-stat-card-hover.active {
  border-color: var(--ops-red);
  box-shadow: 0 0 0 2px var(--ops-red);
}
