/* ============================================================
 * WMS Tandikek — Audit Stock (Stock Opname)
 * ------------------------------------------------------------
 * Tampilan dibuat besar & jelas untuk alur hitung cepat:
 * scan barcode -> isi jumlah fisik -> Enter -> lanjut.
 * ============================================================ */

.ast-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.ast-head h2 {
  font-size: 24px; font-weight: 800; color: var(--brown-800);
  letter-spacing: -.4px; line-height: 1.15;
}
.ast-head p {
  color: var(--muted); font-size: var(--fs-sm); margin-top: 5px;
  max-width: 680px; line-height: 1.55;
}
.ast-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ast-head-note { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }

/* ---------- Chip status ---------- */
.ast-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; line-height: 1.6; white-space: nowrap;
}
.ast-chip.draft { background: var(--amber-soft); color: var(--amber); }
.ast-chip.done { background: var(--green-soft); color: var(--green); }
.ast-chip.blind { background: var(--primary-soft); color: var(--brown-600); }
.ast-chip.open { background: var(--panel-3); color: var(--text-soft); }
.ast-chip.pending { background: var(--panel-3); color: var(--muted); }
.ast-chip.counted { background: var(--blue-soft); color: var(--blue); }
.ast-chip.same { background: var(--green-soft); color: var(--green); }
.ast-chip.less { background: var(--red-soft); color: var(--red); }
.ast-chip.more { background: var(--amber-soft); color: var(--amber); }
:root[data-theme="dark"] .ast-chip.blind { color: var(--primary); }

/* ---------- Progress ---------- */
.ast-progress {
  height: 9px; background: var(--panel-3); border-radius: 999px;
  overflow: hidden; border: 1px solid var(--border);
}
.ast-progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brown-500) 0%, var(--brown-600) 100%);
  transition: width .3s ease;
}
.ast-progress.sm { height: 6px; }
.ast-progress-note { margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }
.ast-progress-cell { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.ast-progress-cell .ast-progress { flex: 1; min-width: 64px; }
.ast-progress-text {
  font-size: var(--fs-xs); color: var(--muted); font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------- Kartu statistik ---------- */
.ast-stats { margin-bottom: 18px; }
.ast-stats .scard.amber { border-left-color: var(--amber); }
.ast-stats .scard.amber .v { color: var(--amber); }
.ast-stats .scard.green { border-left-color: var(--green); }
.ast-stats .scard.green .v { color: var(--green); }
.ast-stats .scard.red { border-left-color: var(--red); }
.ast-stats .scard.red .v { color: var(--red); }
.ast-stats .scard.blue { border-left-color: var(--blue); }
.ast-stats .scard.blue .v { color: var(--blue); }
.ast-stat-sub { margin-top: 4px; font-size: var(--fs-xs); color: var(--muted); }
.ast-progress-card { min-width: 210px; }
.ast-progress-card .v { margin-bottom: 8px; }

/* ---------- Audit berjalan ---------- */
.ast-open-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px;
}
.ast-open-card {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 4px solid var(--primary); border-radius: 10px;
  padding: 14px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
}
:root[data-theme="dark"] .ast-open-card { background: var(--panel-2); }
.ast-open-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ast-open-num {
  font-size: 15px; font-weight: 800; color: var(--brown-800);
  letter-spacing: -.2px; font-variant-numeric: tabular-nums;
}
.ast-open-meta { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.ast-open-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ast-open-progress-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: var(--fs-sm); color: var(--text-soft);
}
.ast-open-progress-row strong { font-variant-numeric: tabular-nums; }
.ast-open-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.ast-muted { color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Riwayat ---------- */
.ast-link {
  color: var(--brown-700); font-weight: 700; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  font-variant-numeric: tabular-nums;
}
.ast-link:hover { color: var(--brown-500); }
.ast-selisih-box { display: inline-flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.ast-delta { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ast-delta.neg { color: var(--red); }
.ast-delta.pos { color: var(--green); }
.ast-delta.zero { color: var(--muted); }
.ast-row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.ast-col-area { white-space: normal; max-width: 220px; }
.ast-empty {
  padding: 46px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 7px; text-align: center;
}
.ast-empty-title { font-size: var(--fs-lg); font-weight: 700; color: var(--brown-800); }
.ast-empty-text { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 7px; }

/* ---------- Kepala sesi ---------- */
.ast-session-panel { border-top: 3px solid var(--primary); }
.ast-session-body {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.ast-session-left { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.ast-session-title-wrap { min-width: 0; }
.ast-session-title {
  font-size: 22px; font-weight: 800; color: var(--brown-800);
  letter-spacing: -.4px; line-height: 1.15; font-variant-numeric: tabular-nums;
}
.ast-session-meta { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
.ast-session-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.ast-session-note {
  margin-top: 8px; font-size: var(--fs-sm); color: var(--text-soft);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 10px; max-width: 620px;
}
.ast-session-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Panel scan ---------- */
.ast-scan-panel { border-top: 3px solid var(--brown-500); }
.ast-scan-panel .panel-body { display: block; }
.ast-scan-left { max-width: 820px; }
.ast-scan-label {
  font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase;
  letter-spacing: .7px; font-weight: 700; margin-bottom: 6px;
}
.ast-scan-row { display: flex; gap: 8px; }
.ast-scan-row .btn { padding-left: 20px; padding-right: 20px; }
.ast-scan-input {
  flex: 1; min-width: 0; height: 46px; font-size: 15px;
  font-weight: 600; letter-spacing: .5px; border-width: 2px;
}
.ast-scan-input:focus { border-color: var(--brown-500); box-shadow: 0 0 0 4px rgba(150, 102, 58, .16); }
.ast-scan-hint { color: var(--muted); font-size: var(--fs-sm); margin-top: 8px; line-height: 1.5; }
.ast-scan-msg { min-height: 18px; margin-top: 8px; font-size: var(--fs-sm); color: var(--muted); }
.ast-scan-msg.err { color: var(--red); font-weight: 600; }
.ast-scan-msg.ok { color: var(--green); font-weight: 600; }

/* ---------- Jendela mengambang hitung ---------- */
.ast-count-backdrop { z-index: 115; }
.ast-count-modal { max-width: 600px; }
.ast-count-modal .ast-count-name { font-size: 18px; }
.ast-count-modal .ast-figure-value { font-size: 22px; }
.ast-count-modal .ast-qty { font-size: 32px; height: 42px; }
.ast-count-msg { min-height: 18px; margin-top: 8px; font-size: var(--fs-sm); color: var(--muted); }
.ast-count-msg.err { color: var(--red); font-weight: 600; }
.ast-count-hint {
  margin-top: 2px; padding-top: 10px; border-top: 1px dashed var(--border);
  font-size: var(--fs-xs); color: var(--muted); line-height: 1.5;
}
.ast-count-foot { flex-wrap: wrap; }
.ast-count-foot .btn { justify-content: center; }
.ast-count-foot .btn-primary { flex: 1; min-width: 160px; }
.ast-count-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ast-count-name { font-size: 15px; font-weight: 700; color: var(--brown-800); line-height: 1.35; }
.ast-count-meta { margin-top: 3px; font-size: var(--fs-sm); color: var(--muted); }
.ast-count-badge {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; background: var(--primary-soft); color: var(--brown-600);
  padding: 3px 8px; border-radius: 20px; white-space: nowrap;
}
.ast-count-figures { display: flex; gap: 12px; margin-top: 12px; }
.ast-figure {
  flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.ast-figure-label {
  font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; font-weight: 700;
}
.ast-figure-value {
  font-size: 20px; font-weight: 800; color: var(--brown-800);
  font-variant-numeric: tabular-nums; line-height: 1.5;
}
.ast-figure-qty:focus-within { border-color: var(--brown-500); box-shadow: 0 0 0 3px rgba(150, 102, 58, .14); }
.ast-qty {
  width: 100%; min-width: 0; height: 36px; padding: 0 !important;
  border: none !important; background: transparent !important;
  box-shadow: none !important; text-align: right;
  font-size: 27px; font-weight: 800; color: var(--brown-800);
  font-variant-numeric: tabular-nums;
}
.ast-qty::placeholder { color: var(--muted); opacity: .5; }
.ast-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Daftar barang ---------- */
.ast-items-toolbar { gap: 8px; }
.ast-filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ast-items-search { min-width: 190px; max-width: 270px; }
.ast-table-scroll { max-height: 62vh; overflow: auto; }
.ast-items-table { min-width: 1020px; }
.ast-items-table td, .ast-items-table th { padding: 8px 10px; }
.ast-items-table th { z-index: 6; }
.ast-col-name { white-space: normal; min-width: 210px; max-width: 330px; }
.ast-col-lokasi { white-space: normal; max-width: 210px; }
.ast-col-time { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.ast-qty-inline {
  width: 90px; padding: 4px 8px; text-align: right;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.ast-row-counted td { background: rgba(47, 122, 79, .045); }
.ast-row-counted:hover td { background: var(--primary-soft); }
:root[data-theme="dark"] .ast-row-counted td { background: rgba(74, 222, 128, .045); }
.ast-blind-note {
  padding: 10px 16px; background: var(--primary-soft);
  border-bottom: 1px solid var(--border);
  color: var(--text-soft); font-size: var(--fs-sm); line-height: 1.55;
}
.ast-mask { letter-spacing: 2px; color: var(--muted); font-weight: 800; }

/* ---------- Modal mulai audit ---------- */
.ast-modal-note {
  background: var(--primary-soft); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: 7px;
  padding: 10px 12px; margin-bottom: 14px;
  font-size: var(--fs-sm); color: var(--text-soft); line-height: 1.55;
}
.ast-create-modal { max-width: 640px; }
.ast-loc-hint { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; margin-top: -2px; }
.ast-loc-search { width: 100%; }
.ast-loc-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.ast-loc-summary { margin-left: auto; font-size: var(--fs-sm); font-weight: 600; color: var(--brown-700); }
.ast-loc-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 2px 8px; max-height: 200px; overflow: auto;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--panel); padding: 6px;
}
.ast-loc-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  border-radius: 6px; cursor: pointer; font-size: var(--fs-sm);
  color: var(--text-soft); user-select: none; min-width: 0;
}
.ast-loc-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ast-loc-item:hover { background: var(--primary-soft); }
.ast-loc-item.terpilih { background: var(--primary-soft); color: var(--brown-800); font-weight: 600; }
.ast-loc-item input { accent-color: var(--brown-600); width: 15px; height: 15px; flex: none; }
.ast-loc-empty { grid-column: 1 / -1; padding: 10px; font-size: var(--fs-sm); color: var(--muted); }
:root[data-theme="dark"] .ast-loc-item.terpilih { color: var(--text); }

/* ---------- Modal selesai audit ---------- */
.ast-finalize-modal { max-width: 560px; }
.ast-finalize-title {
  font-size: var(--fs-lg); font-weight: 800; color: var(--brown-800);
  font-variant-numeric: tabular-nums;
}
.ast-finalize-meta { color: var(--muted); font-size: var(--fs-sm); margin-top: 3px; }
.ast-finalize-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-top: 16px;
}
.ast-finalize-figure {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 12px; display: flex;
  flex-direction: column; gap: 2px;
}
.ast-finalize-value {
  font-size: 20px; font-weight: 800; color: var(--brown-800);
  font-variant-numeric: tabular-nums; line-height: 1.3;
}
.ast-finalize-figure.green { border-left: 3px solid var(--green); }
.ast-finalize-figure.green .ast-finalize-value { color: var(--green); }
.ast-finalize-figure.red { border-left: 3px solid var(--red); }
.ast-finalize-figure.red .ast-finalize-value { color: var(--red); }
.ast-finalize-figure.blue { border-left: 3px solid var(--blue); }
.ast-finalize-figure.blue .ast-finalize-value { color: var(--blue); }
.ast-finalize-label {
  font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; font-weight: 700;
}
.ast-finalize-blind {
  grid-column: 1 / -1; background: var(--primary-soft);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: var(--fs-sm); color: var(--text-soft);
}
.ast-warning {
  margin-top: 12px; background: var(--amber-soft);
  border: 1px solid rgba(169, 112, 10, .35);
  color: var(--amber); border-radius: 8px; padding: 10px 12px;
  font-size: var(--fs-sm); line-height: 1.55; font-weight: 500;
}
.ast-finalize-note {
  margin-top: 12px; color: var(--muted); font-size: var(--fs-sm);
  line-height: 1.55; border-top: 1px dashed var(--border); padding-top: 12px;
}

@media (max-width: 700px) {
  .ast-head h2 { font-size: 20px; }
  .ast-session-title { font-size: 18px; }
  .ast-session-body { flex-direction: column; }
  .ast-session-actions { width: 100%; }
  .ast-session-actions .btn { flex: 1; justify-content: center; }
  .ast-count-figures { flex-direction: column; }
  .ast-count-foot .btn { flex: 1 1 100%; }
  .ast-items-search { max-width: none; width: 100%; }
}
