/*
  CUCILAGI additional styles.
  CSS utama masih berada di index.html agar desain lama tidak berubah.
  Tambahkan style baru atau override kecil di file ini secara bertahap.
*/
.payroll-edit-modal {
  z-index: 140;
}

.page-runtime-loading,
.page-runtime-error {
  display: flex;
  min-height: 12rem;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: #667085;
  font-size: 0.875rem;
  font-weight: 600;
}

.page-runtime-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 9999px;
  animation: page-runtime-spin 0.65s linear infinite;
}

.page-runtime-error {
  margin: 1rem 0;
  min-height: 7rem;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  padding: 1rem;
  text-align: center;
}

@keyframes page-runtime-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1199px) {
  html.mobile-performance-mode *,
  html.mobile-performance-mode *::before,
  html.mobile-performance-mode *::after {
    animation-duration: 180ms !important;
    transition-duration: 180ms !important;
  }

  html.mobile-performance-mode .transition-all {
    transition-property: color, background-color, border-color, opacity, transform !important;
  }

  html.mobile-performance-mode .glass-panel,
  html.mobile-performance-mode .glass-card,
  html.mobile-performance-mode [class*="backdrop-blur"],
  html.mobile-performance-mode [id^="modal-"] {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  html.mobile-performance-mode .animate-blob,
  html.mobile-performance-mode .blur-3xl,
  html.mobile-performance-mode .blur-2xl,
  html.mobile-performance-mode [class*="blur-[80px]"] {
    animation: none !important;
    filter: none !important;
  }

  html.mobile-performance-mode .animate-blob {
    display: none !important;
  }

  html.mobile-performance-mode .glass-card,
  html.mobile-performance-mode .glass-panel,
  html.mobile-performance-mode .module-section-shell,
  html.mobile-performance-mode [id$="-content"] {
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08) !important;
  }

  html.mobile-performance-mode .page-section {
    contain: layout style paint;
  }
}

.customer-picker-list {
  display: flex;
  flex-direction: column;
}

#modal-cari-pelanggan-content {
  width: min(100%, 42rem);
  min-width: 0;
  align-items: stretch !important;
  overflow: hidden;
}

.customer-picker-header,
.customer-picker-heading,
.customer-picker-search,
.customer-picker-scroll,
.customer-picker-list {
  width: 100%;
  min-width: 0;
}

.customer-picker-header {
  position: relative;
  gap: 1rem;
}

.customer-picker-heading {
  padding-right: 3rem;
}

.customer-picker-search,
.customer-picker-scroll {
  align-self: stretch;
}

.customer-picker-scroll {
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#modal-customer-activity-content {
  overflow: hidden;
}

.customer-picker-option {
  width: 100%;
  min-height: 4.75rem;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(9rem, 1.15fr) minmax(8rem, 0.85fr) minmax(11rem, 1fr) 1.5rem;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  color: #374151;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  border: 0;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
}

.customer-picker-option:last-child {
  border-bottom: 0;
}

.customer-picker-option:hover,
.customer-picker-option:focus-visible {
  background: #fff8e6;
  outline: 0;
}

.customer-picker-option:focus-visible {
  box-shadow: inset 0 0 0 2px #ffbb10;
}

.customer-picker-identity,
.customer-picker-contact {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.customer-picker-code {
  color: #b77905;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.customer-picker-name {
  color: #111827;
  font-size: 0.9rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.customer-picker-label {
  color: #9ca3af;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.customer-picker-membership {
  justify-self: start;
  max-width: 100%;
  padding: 0.38rem 0.6rem;
  color: #4b5563;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.customer-picker-membership.is-member {
  color: #9a6b00;
  background: #fff7dc;
  border-color: #fde7a3;
}

.customer-picker-chevron {
  display: inline-flex;
  color: #9ca3af;
}

.customer-activity-trigger:focus-visible {
  outline: 2px solid #ffbb10;
  outline-offset: -2px;
}

.customer-activity-card {
  padding: 0.9rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.85rem;
}

.customer-activity-status {
  flex-shrink: 0;
  padding: 0.3rem 0.5rem;
  color: #4b5563;
  background: #f3f4f6;
  border-radius: 0.5rem;
  font-size: 0.65rem;
  font-weight: 800;
}

.finance-description-preview {
  display: inline-block;
  width: min(20rem, 34vw);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.module-section-header {
  width: 100%;
  min-width: 0;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
}

.module-section-header > :first-child {
  width: 100%;
  min-width: 0;
}

.module-section-toolbar {
  width: 100% !important;
  min-width: 0;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.65rem !important;
  overflow: visible !important;
  padding-bottom: 0 !important;
}

.module-section-toolbar > * {
  min-width: 0;
}

.module-section-action {
  align-self: flex-start;
}

.report-section-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(17rem, 1.35fr) minmax(9.5rem, 0.65fr) minmax(20rem, 1.25fr) auto;
  align-items: stretch;
  gap: 0.65rem;
  width: 100%;
}

.report-customer-toolbar {
  grid-template-columns: minmax(17rem, 1fr) minmax(10rem, 13rem) auto;
}

.report-search-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  height: 2.75rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.report-search-group:focus-within {
  border-color: #ffbb10;
  box-shadow: 0 0 0 3px rgba(255, 187, 16, 0.12);
}

.report-search-field {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.55rem;
  padding-left: 0.85rem;
  color: #9ca3af;
}

.report-search-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 0.7rem 0 0;
  color: #374151;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 0.82rem;
}

.report-toolbar-control,
.report-toolbar-button {
  height: 2.75rem;
  border-radius: 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.report-toolbar-control {
  width: 100%;
  padding: 0 0.85rem;
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
  outline: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.report-toolbar-control:focus {
  border-color: #ffbb10;
}

.report-toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 0.95rem;
  white-space: nowrap;
}

.report-toolbar-button-dark {
  height: 100%;
  color: #fff;
  background: #111827;
  border: 0;
  border-radius: 0;
}

.report-toolbar-button-dark:hover {
  background: #000;
}

.report-toolbar-button-light {
  color: #4b5563;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.report-toolbar-button-light:hover {
  background: #f9fafb;
}

.report-period-control {
  display: grid;
  grid-template-columns: auto minmax(7.5rem, 1fr) auto;
  align-items: center;
  min-width: 0;
  height: 2.75rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.report-period-control select,
.report-period-control input {
  min-width: 0;
  height: 100%;
  color: #374151;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.report-period-control select {
  max-width: 8.5rem;
  padding: 0 0.65rem;
  border-right: 1px solid #e5e7eb;
}

.report-period-input {
  min-width: 0;
  height: 100%;
}

.report-period-input input {
  width: 100%;
  padding: 0 0.55rem;
}

.report-period-apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: calc(100% - 0.4rem);
  margin-right: 0.2rem;
  padding: 0 0.7rem;
  color: #fff;
  background: #ffbb10;
  border: 0;
  border-radius: 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.report-period-apply:hover {
  background: #e5a80e;
}

@media (max-width: 1023px) {
  .module-section-toolbar {
    row-gap: 0.75rem !important;
  }

  .report-filter-toolbar,
  .report-customer-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(10rem, 0.55fr) auto;
  }

  .report-production-toolbar .report-period-control {
    grid-column: 1 / 3;
  }
}

@media (max-width: 767px) {
  #modal-cari-pelanggan {
    align-items: center !important;
    padding: 0.65rem !important;
  }

  #modal-customer-activity {
    align-items: flex-end;
    padding: 0.65rem;
  }

  #modal-cari-pelanggan,
  #modal-customer-activity {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #modal-cari-pelanggan-content {
    width: 100% !important;
    height: min(44rem, calc(100dvh - 1.3rem));
    max-height: calc(100dvh - 1.3rem);
    padding: 1rem;
    border-radius: 1.25rem;
  }

  #modal-customer-activity-content {
    max-height: calc(100dvh - 1.3rem);
    padding: 1rem;
    border-radius: 1.25rem;
  }

  .customer-picker-header {
    margin-bottom: 1rem !important;
  }

  .customer-picker-header > button {
    position: absolute;
    top: 0;
    right: 0;
  }

  .customer-picker-heading {
    padding: 0 3rem;
    text-align: center;
  }

  .customer-picker-search {
    margin-bottom: 0.75rem !important;
  }

  .customer-picker-search input {
    min-height: 3rem;
    padding-right: 0.85rem;
  }

  .customer-picker-scroll {
    border-radius: 0.9rem;
  }

  .customer-picker-option {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem 0.75rem;
    align-items: start;
    padding: 0.85rem;
  }

  .customer-picker-contact {
    grid-column: 1;
    font-size: 0.78rem;
  }

  .customer-picker-membership {
    grid-column: 1;
    justify-self: start;
  }

  .customer-picker-chevron {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }

  .customer-activity-table {
    display: none;
  }

  .customer-activity-cards {
    display: block !important;
  }

  .module-section-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .module-section-toolbar > * {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    grid-column: 1;
  }

  .module-section-toolbar .data-actions {
    display: flex !important;
    width: 100% !important;
    overflow-x: auto !important;
    padding-bottom: 0.2rem !important;
  }

  .module-section-action {
    width: 100%;
  }

  .report-filter-toolbar,
  .report-customer-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .report-filter-toolbar > *,
  .report-production-toolbar .report-period-control {
    grid-column: 1;
    width: 100%;
  }

  .report-period-control {
    grid-template-columns: minmax(5.5rem, 0.65fr) minmax(0, 1fr) auto;
  }

  .report-period-control select {
    max-width: none;
  }

  .report-toolbar-button-light {
    min-height: 2.75rem;
  }

  .finance-description-preview {
    width: 9rem;
  }
}

.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(17, 24, 39, 0.42);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.app-loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.app-loading-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: min(22rem, 100%);
  padding: 1rem 1.1rem;
  border: 1px solid rgba(229, 231, 235, 0.95);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.app-loading-spinner {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border: 3px solid #e5e7eb;
  border-top-color: #ffbb10;
  border-radius: 999px;
  animation: app-loading-spin 700ms linear infinite;
}

.app-loading-title {
  color: #111827;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.3;
}

.app-loading-note {
  margin-top: 0.15rem;
  color: #6b7280;
  font-size: 0.72rem;
  line-height: 1.35;
}

@keyframes app-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-loading-overlay {
    transition: none;
  }

  .app-loading-spinner {
    animation-duration: 1200ms;
  }
}
