.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.25rem;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; align-items: center; }
.toolbar-tabs { justify-content: space-between; align-items: center; }
.toolbar-end { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-left: auto; }
.stock-toolbar { gap: 0.5rem; flex-wrap: nowrap; }
.stock-toolbar .stock-search {
  flex: 1 1 12rem;
  min-width: 9rem;
  max-width: 20rem;
}
.stock-branch-wrap select {
  min-width: 11rem;
  max-width: 16rem;
}
.stock-branch-fixed {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.05rem;
  margin: 0;
  padding: 0.15rem 0.85rem 0.15rem 0;
  border-right: 1px solid var(--border);
  margin-right: 0.15rem;
  max-width: 18rem;
  line-height: 1.2;
  flex-shrink: 0;
}
.stock-branch-kicker {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.stock-branch-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stock-date-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.stock-date-inline input[type="date"] {
  min-width: 0;
  max-width: 10.5rem;
  width: 10.5rem;
}
.stock-date-sep { margin: 0; }
.btn-stock-tool {
  min-width: 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  line-height: 1;
}
.btn-stock-tool .stock-tool-ico {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}
.btn.btn-stock-search {
  color: #fff !important;
  background: #0f7a3f !important;
  border-color: #0c6433 !important;
}
.btn.btn-stock-search:hover { background: #0c6433 !important; opacity: 1; }
.btn.btn-stock-reload {
  color: #fff !important;
  background: #1a5fa8 !important;
  border-color: #154d88 !important;
}
.btn.btn-stock-reload:hover { background: #154d88 !important; opacity: 1; }
.btn.btn-stock-reset {
  color: #fff !important;
  background: #c47a00 !important;
  border-color: #9a6000 !important;
}
.btn.btn-stock-reset:hover { background: #9a6000 !important; opacity: 1; }
@media (max-width: 860px) {
  .stock-toolbar { flex-wrap: wrap; }
}
.tab-group { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.2rem; background: #f0f2f8; border-radius: 10px; }
.tab-btn { background: transparent; border: 0; color: var(--navy); }
.tab-btn.is-active { background: var(--navy); color: #fff; }
.tab-btn.is-active:hover { opacity: 1; }

.data-table td.num,
.data-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Aksi: jangan display:flex di <td> (merusak tinggi/simetri baris tabel). */
.data-table td.action-cell,
.data-table td.row-actions {
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}
.data-table td.action-cell > .btn,
.data-table td.action-cell > a.btn,
.data-table td.row-actions > .btn,
.data-table td.row-actions > a.btn {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.35rem;
}
.data-table td.action-cell > .btn:first-child,
.data-table td.action-cell > a.btn:first-child,
.data-table td.row-actions > .btn:first-child,
.data-table td.row-actions > a.btn:first-child {
  margin-left: 0;
}
.btn.btn-stock-act {
  box-sizing: border-box;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid transparent;
  gap: 0;
}
.btn.btn-stock-act .stock-act-ico {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}
.btn.btn-stock-plus {
  color: #fff !important;
  background: #0f7a3f !important;
  border-color: #0c6433 !important;
}
.btn.btn-stock-plus:hover { background: #0c6433 !important; opacity: 1; }
.btn.btn-stock-minus {
  color: #fff !important;
  background: #c62828 !important;
  border-color: #a51f1f !important;
}
.btn.btn-stock-minus:hover { background: #a51f1f !important; opacity: 1; }
.btn.btn-stock-info {
  color: #fff !important;
  background: #1a5fa8 !important;
  border-color: #154d88 !important;
}
.btn.btn-stock-info:hover { background: #154d88 !important; opacity: 1; }
.radio-row {
  border: 0;
  padding: 0;
  margin: 0 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}
.radio-row legend {
  font-weight: 600;
  margin-bottom: 0.35rem;
  width: 100%;
  padding: 0;
}

.btn-action {
  min-height: 2.35rem;
  min-width: 3.75rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
}

.product-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  vertical-align: middle;
  background: #f0f2f8;
}
.product-thumb-lg {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f0f2f8;
}
.media-list { display: flex; flex-direction: column; gap: 0.75rem; }
.media-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfe;
}
.media-actions { display: flex; flex-direction: column; gap: 0.35rem; }
.media-default { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; }
.crop-wrap {
  max-height: 420px;
  background: #111;
  overflow: hidden;
}
.crop-wrap img { display: block; max-width: 100%; }
.product-media-preview { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.photo-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
}
.photo-upload-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: var(--surface, #fff);
}
.photo-upload-head {
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.photo-upload-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
}
.photo-preview {
  width: 96px;
  height: 96px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f7f7f8;
  text-align: center;
  padding: 0.25rem;
}
.photo-preview-ktp {
  width: 128px;
  height: 96px;
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-dropzone,
.media-dropzone {
  outline: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.photo-dropzone:focus,
.media-dropzone:focus {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #2563eb) 35%, transparent);
}
.photo-dropzone.is-dragover,
.media-dropzone.is-dragover {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #2563eb) 40%, transparent);
}
.media-list.media-dropzone {
  min-height: 4.5rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.5rem;
}

@media (max-width: 860px) {
  .photo-upload-grid { grid-template-columns: 1fr; }
  .photo-upload-body { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .media-row { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .toolbar-tabs {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-end {
    margin-left: 0;
  }
  .tab-group {
    width: 100%;
  }
  .tab-btn {
    flex: 1;
  }
  .section-head {
    flex-wrap: wrap;
  }
}
.toolbar input, .toolbar select, .form-stack input, .form-stack select, .form-stack textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.7rem;
  font: inherit; background: #fff; min-width: 180px; min-height: 2.5rem;
}
.toolbar .btn { min-height: 2.5rem; }
.btn {
  border: 0; border-radius: 8px; padding: 0.55rem 0.95rem; font: inherit; cursor: pointer;
  background: #edf0f7; color: var(--navy); transition: transform .1s ease, opacity .1s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.8; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-accent { background: var(--amber); color: var(--navy); font-weight: 600; }
.btn-secondary { background: #e8ecf8; color: var(--navy); font-weight: 600; border: 1px solid #c5cee4; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-block { width: 100%; }
.btn-icon { background: transparent; border: 0; font-size: 1.2rem; cursor: pointer; color: var(--navy); }

.btn-spinner {
  display: none;
  width: 1rem; height: 1rem; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
.btn.is-loading .btn-spinner { display: inline-block; }
.btn:not(.btn-primary).is-loading .btn-spinner,
.btn-accent.is-loading .btn-spinner {
  border-color: rgba(30, 39, 97, 0.2);
  border-top-color: var(--navy);
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.data-table th { color: var(--muted); font-weight: 600; background: #fafbfe; }
.data-table tr:hover td { background: #f9fafc; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat-card {
  background: linear-gradient(160deg, #fff 0%, #f5f7fd 100%);
  border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem;
}
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-value { display: block; margin-top: 0.35rem; font-size: 1.6rem; color: var(--navy); }

.form-stack { display: flex; flex-direction: column; gap: 0.85rem; }
.form-stack label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }

/* ---- Kartu keranjang (cart) ---- */
.cart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.cart-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0.9rem 1rem 0.85rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.cart-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}
.cart-customer { font-weight: 600; color: var(--navy); line-height: 1.3; }
.cart-customer-meta { color: var(--muted); font-size: 0.82rem; margin-top: 0.15rem; }
.cart-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.cart-items {
  list-style: none;
  margin: 0;
  padding: 0.6rem 0 0;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 12rem;
  overflow-x: hidden;
  overflow-y: auto;
}
.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.88rem;
  min-width: 0;
}
.cart-item-name {
  line-height: 1.35;
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}
.cart-item-qty { color: var(--muted); white-space: nowrap; }
.cart-item-row .btn { flex: 0 0 auto; white-space: nowrap; }
.cart-empty-items { color: var(--muted); font-size: 0.86rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); }
.cart-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}
.cart-total-label { color: var(--muted); }
.cart-total-value { font-weight: 600; color: var(--navy); }
.cart-card-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin-top: auto;
  align-items: center;
}
.cart-card-actions .btn,
.cart-item-row .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.btn.btn-cart-act {
  box-sizing: border-box;
  padding: 0.28rem 0.55rem !important;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 7px;
  border: 1px solid transparent;
  white-space: nowrap;
  min-height: 0;
}
.btn.btn-cart-act .btn-ico {
  font-size: 0.85em;
}
.btn.btn-cart-add {
  color: #fff !important;
  background: #1a5fa8 !important;
  border-color: #154d88 !important;
}
.btn.btn-cart-add:hover { background: #154d88 !important; opacity: 1; }
.btn.btn-cart-checkout {
  color: #fff !important;
  background: #0f7a3f !important;
  border-color: #0c6433 !important;
}
.btn.btn-cart-checkout:hover { background: #0c6433 !important; opacity: 1; }
.btn.btn-cart-checkout:disabled,
.btn.btn-cart-checkout[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.btn-cart-cancel {
  color: #fff !important;
  background: #c62828 !important;
  border-color: #a51f1f !important;
}
.btn.btn-cart-cancel:hover { background: #a51f1f !important; opacity: 1; }
.btn.btn-cart-detail {
  color: var(--navy) !important;
  background: #eef1f8 !important;
  border-color: #d5dbeb !important;
}
.btn.btn-cart-detail:hover { background: #e0e6f4 !important; opacity: 1; }
.btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
  min-width: 0.9em;
}
@media (max-width: 560px) {
  .cart-card-actions { flex-wrap: wrap; }
}
.cart-grid-empty {
  grid-column: 1 / -1;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
@media (max-width: 560px) {
  .cart-grid { grid-template-columns: 1fr; }
}

/* Combobox wilayah (pencarian AJAX) */
.wilayah-combo {
  position: relative;
  width: 100%;
  min-width: 0;
}
.wilayah-combo .wilayah-search {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
  box-sizing: border-box;
}
.wilayah-combo .wilayah-search:disabled {
  background: #f0f2f7;
  color: var(--navy);
  cursor: default;
  opacity: 1;
}
.wilayah-combo .wilayah-search:focus {
  outline: 2px solid rgba(30, 39, 97, 0.2);
  border-color: var(--navy);
}
.wilayah-results {
  position: absolute;
  z-index: 60;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}
.wilayah-item {
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--navy);
}
.wilayah-item:hover,
.wilayah-item.is-active {
  background: #f0f3fb;
}
.wilayah-empty,
.wilayah-loading {
  padding: 0.55rem 0.7rem;
  color: var(--muted);
  font-size: 0.88rem;
}
/* Hasil pencarian produk di modal stok: flow biasa agar tidak terpotong overflow modal-body */
#adj-product-combo .wilayah-results {
  position: static;
  box-shadow: none;
  margin-top: 0.35rem;
  max-height: 180px;
}
.form-stack input.is-readonly,
.form-stack select.is-readonly,
.form-stack input[readonly],
.form-stack select:disabled {
  background: #f0f2f7;
  color: var(--navy);
  cursor: default;
  opacity: 1;
}
.form-error {
  color: var(--danger); margin: 0; font-size: 0.9rem; line-height: 1.4;
  background: #fef2f2; border: 1px solid #f5c2c2; border-radius: 8px;
  padding: 0.55rem 0.7rem;
}
.info-box {
  background: #f3f6ff; border: 1px dashed #c9d2ef; border-radius: 8px;
  padding: 0.85rem 1rem; margin-bottom: 1rem; color: var(--navy);
}
.section-title { margin: 1.2rem 0 0.6rem; font-size: 1rem; color: var(--navy); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.2rem 0 0.6rem; }
.section-head .section-title { margin: 0; }

.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; background: #eef1f8; color: var(--navy);
}
.badge-success { background: #e6f6ec; color: var(--success); }
.badge-warn    { background: #fff4df; color: #9a6b00; }
.badge-warning { background: #fff4df; color: #9a6b00; }
.badge-info    { background: #e6f2ff; color: #1a5fa8; }
.badge-primary { background: #eaedfc; color: var(--navy); }
.badge-danger  { background: #fdecea; color: #c0392b; }

.toast-root { position: fixed; right: 1rem; bottom: 1rem; z-index: var(--z-toast, 210); display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  min-width: 220px; max-width: 360px; padding: 0.75rem 0.9rem; border-radius: 8px;
  background: var(--navy); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  animation: toast-in .2s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
.toast.info { background: var(--primary, #0284c7); }
.toast.warning, .toast.warn { background: var(--warning, #d97706); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,24,48,0.45); display: none;
  /* Modal di tengah horizontal, agak ke atas (nyaman baca), scroll jika konten panjang */
  align-items: flex-start;
  justify-content: center;
  z-index: var(--z-modal, 200);
  padding: max(1.5rem, 9vh) 1rem max(2rem, 10vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: min(480px, 100%);
  padding: 1.1rem 1.2rem 1.2rem; box-shadow: 0 20px 48px rgba(0,0,0,0.2);
  margin: 0 auto;
  flex-shrink: 0;
  max-height: none;
}
.modal.wide { width: min(920px, 96vw); }
.modal-form {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 880px);
  padding: 0;
  overflow: hidden;
}
.modal-form > .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-form > .modal-header .modal-title { margin: 0; font-size: 1.05rem; }
.modal-form > .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  max-height: none;
  min-height: 0;
}
.modal-form > .modal-actions {
  margin-top: 0;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #fafbfe;
  flex-shrink: 0;
}
.modal-close {
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.25rem 0.55rem;
  min-width: 2rem;
  min-height: 2rem;
}
.modal-body { max-height: min(65vh, 560px); overflow: auto; min-height: 4rem; }
.modal-body-stack { display: flex; flex-direction: column; gap: 1rem; }
.form-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem 1rem;
}
.info-grid-item { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.info-grid-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.info-grid-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.35;
  word-break: break-word;
}
.info-grid-value.is-danger { color: var(--danger); }
.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  margin-bottom: 0.4rem;
}
.field-label .req { color: var(--danger); margin-left: 0.2rem; }
.field-input,
.form-card select,
.form-card textarea,
.form-card input[type="date"],
.form-card input[type="number"],
.form-card input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
  min-height: 2.5rem;
}
.form-card textarea { min-height: 5.5rem; resize: vertical; }
.input-row { display: flex; align-items: center; gap: 0.5rem; }
.input-row .field-input { flex: 1; min-width: 0; }
.input-row .btn { flex-shrink: 0; white-space: nowrap; min-height: 2.5rem; }
.form-fields { display: flex; flex-direction: column; gap: 0.85rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}
.modal-body.modal-body-tall { min-height: 350px; }
.modal h3, .modal-title { margin: 0 0 0.85rem; color: var(--navy); }
.modal-form .modal-title { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; flex-shrink: 0; }
.modal-actions--split { justify-content: space-between; align-items: center; }
.modal-actions__start,
.modal-actions__end { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* Loading di dalam modal (Lihat/Ubah async) */
.modal-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.85rem; padding: 2rem 1rem; min-height: 8rem; color: var(--muted);
}
.modal-loading-spinner {
  width: 2rem; height: 2rem; flex-shrink: 0;
  border: 3px solid rgba(30, 39, 97, 0.15);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
.modal-loading-text { margin: 0; font-size: 0.95rem; color: var(--muted); }
.modal-load-error { padding: 0.5rem 0 0.25rem; }
.modal-load-error .hint { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.85rem; }

/* Dialog konfirmasi / prompt (ganti confirm/prompt browser) */
.modal.modal-confirm { width: min(420px, 100%); }
.modal-confirm-message {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--navy);
  white-space: pre-wrap;
}

/* ---- Halaman form full-page (bukan modal): di tengah container content ---- */
.panel.form-page {
  width: 100%;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}
.panel.form-page--wide {
  max-width: 1100px;
}
.panel.form-page .toolbar {
  justify-content: flex-start;
}
.panel.form-page .form-stack {
  width: 100%;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.25rem;
}
.panel.form-page fieldset:last-of-type {
  margin-bottom: 0.5rem;
}

/* Fallback: data-page form/detail tanpa class form-page */
.panel[data-page$="-form"],
.panel[data-page$="-detail"] {
  width: 100%;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}
.panel[data-page$="-detail"] {
  max-width: 1100px;
}

/* Matrix akses: cukup di tengah, sedikit lebih lebar */
.panel[data-page="role-access"] {
  width: 100%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.perm-matrix { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.perm-matrix th, .perm-matrix td { padding: 0.45rem 0.35rem; border-bottom: 1px solid var(--border); text-align: center; }
.perm-matrix th:first-child, .perm-matrix td:first-child { text-align: left; }
.perm-matrix th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: #fff; }

/* ---- Loading AJAX: tombol, tabel, halaman ---- */
.inline-loading {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.65rem; padding: 0.75rem; color: var(--muted); font-size: 0.92rem;
}
.inline-loading-spinner {
  width: 1.25rem; height: 1.25rem; flex-shrink: 0;
  border: 2px solid rgba(30, 39, 97, 0.15);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
.inline-loading-text { margin: 0; }
.table-loading-row td {
  text-align: center !important;
  padding: 2rem 1rem !important;
  background: #fafbfe;
}
.table-empty-msg {
  text-align: center !important;
  color: var(--muted);
  padding: 1.25rem !important;
}
.page-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: inherit;
  min-height: 6rem;
}
.is-page-loading {
  pointer-events: none;
}
.is-page-loading > *:not(.page-loading-overlay) {
  opacity: 0.45;
  filter: grayscale(0.05);
}

/* ---- Ringkasan checkout (simulasi angsuran) ---- */
.checkout-summary-box {
  background: #f4f7fd;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.checkout-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  gap: 0.5rem;
}
.checkout-summary-row > span:last-child {
  font-weight: 600;
  color: var(--navy);
  text-align: right;
  white-space: nowrap;
}
.checkout-summary-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}
.checkout-summary-total {
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
}
.checkout-summary-total > span:last-child {
  font-size: 1.1rem;
  color: var(--success, #2f9e64);
}
.checkout-summary-note {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
}
