.kj-wrap .select2 {
  min-width: 400px;
}

.kj-hidden {
  display: none;
}

.kj-loader {
  width: 45px;
  aspect-ratio: 1;
  --c: no-repeat linear-gradient(#000 0 0);
  background:
    var(--c) 0% 50%,
    var(--c) 50% 50%,
    var(--c) 100% 50%;
  background-size: 20% 100%;
  animation: l1 1s infinite linear;
}
@keyframes l1 {
  0% {
    background-size:
      20% 100%,
      20% 100%,
      20% 100%;
  }
  33% {
    background-size:
      20% 10%,
      20% 100%,
      20% 100%;
  }
  50% {
    background-size:
      20% 100%,
      20% 10%,
      20% 100%;
  }
  66% {
    background-size:
      20% 100%,
      20% 100%,
      20% 10%;
  }
  100% {
    background-size:
      20% 100%,
      20% 100%,
      20% 100%;
  }
}

.kj-wrap .woocommerce-layout__header {
  margin-left: -20px;
}

.kj-wrap .button-primary {
  margin: 0.1rem;
}
.kj-wrap table th {
  font-weight: 600;
}

/** Modal */
.kj-wrap .media-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 360px;
  background: #000;
  opacity: 0.7;
  z-index: 159900;
}

/**General Modal*/
.kj-wrap .modal-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 160000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.kj-wrap .media-modal {
  position: static;
  background-color: #fff;
  overflow-y: auto;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
@media only screen and (min-width: 800px) {
  .kj-wrap .media-modal:not([style*='max-width']) {
    max-width: 70vw;
  }
}

.kj-wrap .media-modal .media-modal-container {
  position: relative;
}

.kj-wrap .media-modal .content-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  min-height: 50px;
  border-bottom: 1px solid #dfdfdf;
  background-color: #fff;
  z-index: 1;
}

.kj-wrap .media-modal .content-header h1 {
  padding: 0 16px;
  font-size: 18px;
  line-height: 50px;
  margin: 0;
  font-weight: 500;
}

.kj-wrap .media-modal .closebtn-container {
  position: absolute;
  top: 14px;
  right: 14px;
  cursor: pointer;
  z-index: 160100;
}

.kj-wrap .media-modal .content-body {
  padding: 15px 15px 20px 15px;
}

/** Modal - END */
.kj-wrap .wp-core-ui select {
  width: 100%;
}

.kj-wrap button {
  width: auto !important;
  cursor: pointer;
  display: inline-block;
}

.kj-wrap button:disabled,
.kj-wrap button[disabled] {
  cursor: auto;
  opacity: 0.5;
}

.kj-wrap .alert {
  box-shadow: 0 0 0 transparent;
  border-radius: 4px;
  border: 2px solid #d63638;
  background-color: #fcf0f1;
  color: #d63638;
  padding: 10px 18px;
}
.kj-wrap .alert.success {
  box-shadow: 0 0 0 transparent;
  border-radius: 4px;
  border: 2px solid #2271b1;
  background-color: #d7e3ff;
  color: #2271b1;
  padding: 10px 18px;
}

.woocommerce-homescreen {
  max-width: 100% !important;
}

.wc-backbone-modal.kiriof-backbone-modal .wc-backbone-modal-main {
  width: 100%;
  max-width: none;
}

.wc-backbone-modal.kiriof-backbone-modal .wc-backbone-modal-header h1 {
  padding-right: 56px;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-modal-body {
  padding: 24px;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-modal-loader {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* WC order preview compact summary — override heavy WC table padding */
.wc-order-preview .wc-order-preview-table .kiriof-order-preview-summary-wrap-cell {
  border-top: 1px solid #eee !important;
  border-bottom: 0 !important;
}

.kiriof-order-preview-compact-summary {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

/* Match WC specificity to override .wc-order-preview .wc-order-preview-table td */
.wc-order-preview .wc-order-preview-table .kiriof-order-preview-compact-summary td {
  padding: 4px 0;
  vertical-align: middle;
  border: 0;
  text-align: left;
}

.wc-order-preview .wc-order-preview-table .kiriof-order-preview-compact-summary td:last-child {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-summary {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-summary td {
  padding: 3px 0;
  vertical-align: middle;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-field textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-counter {
  margin-top: 6px;
  text-align: right;
  font-size: 12px;
  color: #757575;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-inline-error,
.wc-backbone-modal.kiriof-backbone-modal .kiriof-backbone-modal-error-text {
  margin: 16px 0 0;
  color: #d63638;
  font-weight: 600;
}

.wc-backbone-modal.kiriof-backbone-modal .kiriof-button-danger {
  background: #d63638;
  border-color: #d63638;
}

/* Legacy .kj-badge rules now live in kj-badge.css (unified kiriof-badge system).
   The aliases below are kept so any late-hooked markup still renders. */

.kj-badge.kiriof-badge--deficit-label {
  background: #d63638;
  color: #fff;
  font-weight: 700;
}

/* COD Adjustment Modal overlay */
.kiriof-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kiriof-modal {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.28);
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px 28px 20px;
  position: relative;
}
.kiriof-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}
.kiriof-modal__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.3;
}
.kiriof-modal__subtitle {
  font-size: 13px;
  color: #50575e;
  margin: 0;
}
.kiriof-modal__close {
  background: none;
  border: 1px solid #c3c4c7;
  border-radius: 3px;
  width: 28px;
  height: 28px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  margin-left: 12px;
}
.kiriof-modal__close:hover {
  background: #f0f0f1;
}
.kiriof-modal__description {
  font-size: 13px;
  margin: 10px 0 16px;
  color: #1e1e1e;
}
.kiriof-modal__field {
  margin-bottom: 14px;
}
.kiriof-modal__label {
  font-size: 13px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.kiriof-modal__input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #8c8f94;
  border-radius: 3px;
  overflow: hidden;
  width: 200px;
}
.kiriof-modal__input-prefix {
  padding: 6px 8px;
  background: #f6f7f7;
  border-right: 1px solid #8c8f94;
  font-size: 13px;
  color: #50575e;
}
.kiriof-modal__input {
  border: none !important;
  box-shadow: none !important;
  padding: 6px 8px !important;
  flex: 1;
  min-width: 0;
  font-size: 14px;
}
.kiriof-modal__hint {
  font-size: 12px;
  color: #d63638;
  margin: 4px 0 0;
  min-height: 16px;
}
.kiriof-modal__breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.kiriof-modal__breakdown td {
  padding: 4px 0;
  vertical-align: top;
}
.kiriof-modal__breakdown td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.kiriof-breakdown__row--parent > td:first-child {
  font-weight: 600;
}
.kiriof-breakdown__row--child > td:first-child {
  padding-left: 16px;
  color: #50575e;
}
.kiriof-breakdown__row--strong > td {
  font-weight: 600;
  border-top: 1px solid #e2e4e7;
  padding-top: 6px;
}
.kiriof-breakdown__row--payout > td {
  font-weight: 700;
  color: #007017;
}
.kiriof-breakdown__value--discount {
  color: #d63638;
}
.kiriof-breakdown__value--payout {
  color: inherit;
}
.kiriof-badge--discount {
  background: #e5f3fb;
  color: #0a4b78;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  vertical-align: middle;
}
.kiriof-modal__footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #e2e4e7;
  padding-top: 14px;
}
.kiriof-modal__btn--primary {
  background: #2271b1;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.kiriof-modal__btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.kiriof-modal__btn--primary:not(:disabled):hover {
  background: #135e96;
}

#kj-order-edit-shipping th {
  text-align: left;
  display: flex;
}
#kj-order-edit-shipping td {
  text-align: right;
}

button.select2-selection__clear {
  background: white !important;
  border: none !important;
}

button.select2-selection__clear {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.kj-wrap button.select2-selection__choice__remove {
  background: none !important;
  border: none !important;
  padding: 0 4px !important;
  border-radius: 0 !important;
  top: -2px !important;
}

@media only screen and (max-width: 800px) {
  .wrap.kj-wrap {
    clear: both;
    margin-right: 12px;
    margin-left: 20px;
  }
}

/* Workspace boot skeleton: server-rendered inside each Svelte root so the
 * WP content area never flashes blank while the ESM bundle initializes.
 * Cleared by admin-workspace.ts before Svelte mounts. */
.kiriof-workspace-boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 320px;
  padding: 64px 24px;
  text-align: center;
}

.kiriof-workspace-boot__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #ddd7ee;
  border-top-color: #5c2ecb;
  border-radius: 50%;
  animation: kiriof-workspace-boot-spin 0.8s linear infinite;
}

@keyframes kiriof-workspace-boot-spin {
  to {
    transform: rotate(360deg);
  }
}

.kiriof-workspace-boot__title {
  margin: 0;
  color: #241b3d;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.kiriof-workspace-boot__hint {
  margin: 0;
  color: #646970;
  font-size: 12px;
  line-height: 1.5;
}

.kiriof-workspace-boot__bars {
  display: grid;
  gap: 8px;
  width: min(420px, 100%);
  margin-top: 8px;
}

.kiriof-workspace-boot__bars span {
  display: block;
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: #eeeaf8;
}

.kiriof-workspace-boot__bars span:nth-child(2) {
  width: 82%;
  margin: 0 auto;
}

.kiriof-workspace-boot__bars span:nth-child(3) {
  width: 64%;
  margin: 0 auto;
}

.kiriof-workspace-boot__bars span::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  content: '';
  animation: kiriof-workspace-boot-shimmer 1.4s infinite;
  transform: translateX(-100%);
}

@keyframes kiriof-workspace-boot-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kiriof-workspace-boot__spinner,
  .kiriof-workspace-boot__bars span::after {
    animation-duration: 2.5s;
  }
}
