.stock-page {
  min-height: 100%;
}

body.apu-stock-theme .apu-app-header { background: #16a34a !important; }
body.apu-stock-theme .apu-header-brand-icon,
body.apu-stock-theme #apuHeaderDateRow { color: #dcfce7 !important; }
body.apu-stock-theme .apu-header-logout-btn { background: rgba(21, 128, 61, .55) !important; }
body.apu-stock-theme .apu-desktop-module-nav-btn:hover { background: rgba(21, 128, 61, .42) !important; }

@media (max-width: 640px) {
  #stockTabBar {
    display: none !important;
  }
}

.stock-tab-btn {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #64748b;
}

.stock-tab-btn:hover {
  border-color: #cbd5e1;
  color: #334155;
}

.stock-tab-active {
  background: #0f172a !important;
  border-color: #0f172a !important;
  color: #ffffff !important;
}
.stock-desktop-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.stock-desktop-share-button {
  display: none;
}
.stock-desktop-share-hidden {
  display: none !important;
}
@media (min-width: 768px) {
  .stock-desktop-share-button:not(.stock-desktop-share-hidden) {
    display: flex;
  }
  .stock-ringkasan-mobile-actions {
    display: none !important;
  }
}
@media (max-width: 640px) {
  .stock-desktop-toolbar {
    display: none !important;
  }
  .stock-ringkasan-mobile-actions {
    display: flex !important;
  }
}
#stockActiveDateWrap .apu-fixed-date-display {
  font-size: 1rem;
  font-weight: 800;
  padding: 0.625rem 0.75rem;
}

#stockActiveDateWrap:focus-within {
  border-radius: 0.75rem !important;
}

@media (max-width: 640px) {
  #stockActiveDateWrap .apu-fixed-date-display {
    padding: 0.625rem 0.75rem;
  }
}

.stock-item-row select,
.stock-item-row input {
  min-width: 0;
}

@media (max-width: 640px) {
  .stock-modal-overlay {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }
  .stock-modal-overlay .stock-modal-card {
    width: 100% !important;
    max-width: none !important;
    height: 100dvh !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  .stock-modal-overlay .stock-modal-card > .bg-slate-800 {
    border-radius: 0 !important;
    flex: 0 0 auto;
  }
  .stock-modal-overlay .stock-modal-body {
    flex: 1 1 auto;
    min-height: 0;
  }
  .stock-modal-overlay .stock-modal-footer {
    flex: 0 0 auto;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .stock-detail-modal > div {
    border-radius: 16px;
  }
}

@media (max-width: 640px) {
  .stock-modal-overlay input[type="text"],
  .stock-modal-overlay input[type="number"],
  .stock-modal-overlay input[type="tel"],
  .stock-modal-overlay input[type="search"],
  .stock-modal-overlay textarea {
    font-size: 16px !important;
  }
}

.stock-page select,
.stock-modal-overlay select,
#stockOpnameModal select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 1.1em;
  padding-right: 2.25rem !important;
  cursor: pointer;
}
/* appearance: none membuat WebKit memakai padding, jadi tinggi tetap khusus select bawaan (style.css) tidak dipakai di sini. */
@supports (font: -apple-system-body) {
  .stock-page select,
  .stock-modal-overlay select,
  #stockOpnameModal select {
    height: auto;
  }
}
#stockPackingMikaSplit:not(:empty) {
  margin-top: 0.5rem;
}

#stockOpnameModal table {
  min-width: 480px;
}

.stock-packing-dual-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex: 0 0 20px;
  cursor: pointer;
}

.manager-export-red { background-color: rgb(183 27 32); }
.manager-export-red:hover { background-color: rgb(217, 50, 56); }

.stock-skel { border-radius: 16px; background: linear-gradient(100deg, #e8edf3 30%, #f4f7fa 50%, #e8edf3 70%); background-size: 200% 100%; animation: stockShimmer 1.2s linear infinite; }
.stock-skel-date { height: 98px; margin-bottom: 16px; }
.stock-skel-card { height: 220px; }
@keyframes stockShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.stock-date-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
.stock-date-nav button { width: 40px; height: 40px; border-radius: 12px; background: #f1f5f9; color: #334155; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.stock-date-nav button:disabled { opacity: .4; }
.stock-date-nav-label { flex: 1; min-width: 0; text-align: center; font-size: 14px; font-weight: 800; color: #1e293b; }
.stock-seller-row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.stock-seller-btn { flex: 0 0 auto; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; background: #f1f5f9; color: #334155; font-size: 11px; font-weight: 800; }
.stock-seller-btn:disabled { opacity: .35; }
.stock-seller-btn.is-primary { background: #f59e0b; color: #fff; }
.stock-num-input { font-size: 18px; font-weight: 800; min-height: 50px; padding-top: 10px; padding-bottom: 10px; }
.stock-modal-overlay input.stock-num-input { font-size: 18px !important; }
.stock-num-input::placeholder { font-size: 14px; font-weight: 600; color: #94a3b8; }
.stock-row-menu { width: 10rem; }
.stock-row-menu-wrap .stock-row-menu-up { top: auto; bottom: calc(100% + 4px); }
.stock-spinner-loading .fx-spinner { --fx: #d97706; }
.stock-photo-body { display: flex; align-items: center; justify-content: center; min-height: 220px; padding: 8px; background: #ffffff; }
.stock-photo-body .fx-loading { color: #a2acb8; }
.stock-photo-body .cash-photo-full.hidden { display: none; }
.stock-seller-btn.is-danger { background: #fee2e2; color: #b91c1c; }
.date-picker-card.stock-date-card { flex-direction: column; align-items: stretch; gap: 0; }
.date-picker-card.stock-date-card > .date-picker-content { flex: 0 0 auto; width: 472px; max-width: 100%; }
.date-picker-card.stock-date-card > #stockDateNav { width: 472px; max-width: 100%; }
@media (max-width: 640px) {
  .date-picker-card.stock-date-card > .date-picker-content,
  .date-picker-card.stock-date-card > #stockDateNav { width: 100%; }
  #stockSettingsModal.stock-settings-overlay { padding: 0; }
  #stockSettingsModal .stock-settings-card { max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  #stockSettingsModal #stockSettingsBody { flex: 1 1 auto; }
}
.stock-seller-row { flex-wrap: wrap; }
.stock-seller-row > :first-child { flex: 1 1 100%; }
.stock-photo-section { padding-top: 18px; }
.stock-sync-warning { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 12px; padding: 12px; color: #92400e; }
.stock-sync-warning-title { font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.stock-sync-warning-title i { color: #d97706; }
.stock-sync-warning-text { font-size: 12px; font-weight: 600; line-height: 1.45; margin-top: 4px; }
.stock-sync-warning-list { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #fcd34d; display: flex; flex-direction: column; gap: 3px; }
.stock-sync-warning-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; }

.stock-opname-top { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 12px; }
.stock-opname-top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stock-opname-hint { font-size: 12px; font-weight: 600; color: #64748b; }
.stock-opname-progress { display: flex; flex-direction: column; gap: 6px; }
.stock-opname-progress-text { font-size: 13px; font-weight: 800; color: #334155; }
.stock-opname-progress-track { height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.stock-opname-progress-bar { height: 100%; width: 0; border-radius: 999px; background: #16a34a; transition: width .2s ease; }
.stock-opname-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.stock-opname-filters button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid #cbd5e1; background: #fff; color: #475569; font-size: 12px; font-weight: 800; }
.stock-opname-filters button.is-active { background: #1e293b; border-color: #1e293b; color: #fff; }
.stock-opname-count { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 11px; text-align: center; }
.stock-opname-filters button.is-active .stock-opname-count { background: rgba(255, 255, 255, .2); color: #fff; }
.stock-opname-section { display: flex; flex-direction: column; gap: 8px; }
.stock-opname-section-title { font-size: 18px; font-weight: 800; color: #1e293b; text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.stock-opname-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 768px) { .stock-opname-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stock-opname-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.stock-opname-card[data-state="diff"] { border-color: #fecaca; }
.stock-opname-card[data-state="match"] { border-color: #bbf7d0; }
.stock-opname-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.stock-opname-name { font-size: 15px; font-weight: 800; color: #1e293b; line-height: 1.3; min-width: 0; }
.stock-opname-name span { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: #94a3b8; }
.stock-opname-diff { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.stock-opname-diff.is-empty { background: #fef3c7; color: #b45309; }
.stock-opname-diff.is-zero { background: #dcfce7; color: #15803d; }
.stock-opname-diff.is-plus { background: #dcfce7; color: #15803d; }
.stock-opname-diff.is-minus { background: #fee2e2; color: #b91c1c; }
.stock-opname-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px 15px; align-items: stretch; }
.stock-opname-grid:not(.is-final) .stock-opname-value { flex: 1; }
.stock-opname-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stock-opname-label { display: block; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.stock-opname-value { font-size: 18px; font-weight: 800; color: #1e293b; min-height: 40px; display: flex; align-items: center; }
.stock-opname-input { width: 100%; text-align: right; background: #f8fafc; border: 1px solid #94a3b8; border-radius: 12px; padding-left: 12px; padding-right: 12px; color: #1e293b; outline: none; }
.stock-opname-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
.stock-opname-note-toggle { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: #b45309; }
.stock-opname-note-field { display: flex; flex-direction: column; gap: 4px; }
.stock-opname-note-input { width: 100%; background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 12px; padding: 10px 12px; font-size: 16px; font-weight: 600; color: #1e293b; outline: none; }
.stock-opname-note-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
.stock-opname-note-read { display: flex; flex-direction: column; gap: 2px; font-size: 13px; font-weight: 600; color: #475569; }
.stock-opname-empty, .stock-opname-filter-empty { text-align: center; color: #94a3b8; font-size: 13px; font-weight: 700; padding: 14px; }
@media (max-width: 640px) {
  #stockOpnameModal { padding: 0; }
  #stockOpnameModal .stock-modal-card { max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
}
#stockOpnameModalBody { background: #f1f5f9; }
.stock-opname-people { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid #e2e8f0; font-size: 13px; font-weight: 700; color: #334155; }
.stock-opname-people > div { display: flex; flex-direction: column; gap: 2px; }
.stock-opname-people .stock-opname-time { font-weight: 600; color: #94a3b8; }
.stock-opname-hist-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.stock-opname-hist-filter .is-wide { grid-column: 1 / -1; }
.stock-opname-hist-filter label { display: block; margin-bottom: 4px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.stock-opname-hist-filter select { width: 100%; background: #fff; border: 1px solid #cbd5e1; border-radius: 12px; padding: 8px 10px; font-size: 16px; font-weight: 700; color: #1e293b; outline: none; }
.stock-opname-hist-filter select:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
.stock-opname-diff-row { grid-column: 2 / 3; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.stock-opname-diff-num { font-size: 18px; font-weight: 800; color: #94a3b8; }
.stock-opname-diff-num.is-plus { color: #15803d; }
.stock-opname-diff-num.is-minus { color: #b91c1c; }
.stock-opname-grid.is-final { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.stock-opname-grid.is-final .stock-opname-value { min-height: 40px; }
.stock-opname-note-line { display: flex; align-items: center; gap: 8px; }
.stock-opname-note-line .stock-opname-note-input { flex: 1 1 auto; min-width: 0; }
.stock-opname-note-close { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; background: #f1f5f9; color: #b91c1b; display: flex; align-items: center; justify-content: center; }
.stock-opname-note-close:hover { background: #e2e8f0; color: #334155; }
