/* Operational history, approval and owner audit surfaces. Load after theme.css. */
.report-history-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.report-history-section > .section-heading {
  flex-wrap: wrap;
  gap: 16px;
}
.report-history-section > .section-heading > label {
  width: min(100%, 320px);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}
.report-history {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #202222;
  font-size: .76rem;
}
.history-row > div { min-width: 0; }
.history-row b { display: block; line-height: 1.5; }
.history-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .69rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.history-row > strong {
  font-size: .8rem;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.history-row .row-actions { flex-wrap: wrap; }
.history-row > details { grid-column: 1 / -1; }
.history-row details summary,
.report-history details > summary {
  cursor: pointer;
  color: var(--orange-dark);
  line-height: 1.6;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid #454943;
  border-radius: 999px;
  background: #2a2e2a;
  color: #c9cec5;
  font-size: .63rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}
.status-draft,
.status-belum-acc { border-color: #615035; background: #332c20; color: #e8c28b; }
.status-acc,
.status-sudah-acc { border-color: #345670; background: #203040; color: #9ccbf3; }
.status-sinkron,
.status-sudah-sinkron { border-color: #3c6450; background: #20352b; color: #91ddb1; }
.status-final { border-color: #4b765c; background: #253d2d; color: #a2e3b7; }
.status-ditolak,
.status-selisih { border-color: #6e3d37; background: #3c2623; color: #ffa99d; }
.daily-close-panel { border-color: #3c4e43; }
#salesDashboardDialog[open] #dailyCloseForm {
  max-width: none;
  margin: 18px 0 0;
  padding: 0;
}
#dailyCloseForm .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
#dailyCloseForm label {
  min-width: 0;
  color: #c8ccc5;
  font-size: .74rem;
  font-weight: 600;
}
#dailyCloseReasonField { grid-column: 1 / -1; }
#dailyCloseSummary { flex-wrap: wrap; }
#dailyCloseSummary strong,
#dailyCloseSummary b { font-variant-numeric: tabular-nums; }
#finalizeDailyClose { margin-top: 14px; }
#dailyCloseHistory { margin-top: 22px; }
.daily-allocation-table { min-width: 1080px; }
.daily-allocation-head,
.daily-allocation-row {
  grid-template-columns: 95px repeat(5, minmax(125px, 1fr)) minmax(110px, .9fr);
}
.daily-allocation-head > span:not(:first-child) { text-align: right; }
.daily-allocation-head > span:last-child { text-align: center; }
.daily-allocation-row > .status-pill { justify-self: center; }
.daily-allocation-row .record-allocation {
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid #714029;
  border-radius: 7px;
  background: #33241c;
  color: #ffab83;
  font-size: .67rem;
  line-height: 1.4;
}
.daily-allocation-row .record-allocation:not(:disabled):hover { background: #4b2f22; }
.daily-allocation-row .record-allocation:disabled {
  border-color: #373936;
  background: #252725;
  color: var(--muted);
  opacity: 1;
}
#ownerControlDialog { width: min(94vw, 920px); }
.owner-control-section:has(.audit-filters) > .section-heading {
  align-items: start;
  flex-direction: column;
  gap: 16px;
}
.audit-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #202222;
}
.audit-filters label {
  flex: 1 1 170px;
  min-width: 0;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 600;
}
.audit-filters .text-action { min-height: 40px; font-size: .7rem; }
#auditLogList { margin-top: 16px; }
.control-item.audit-entry {
  align-items: start;
  padding: 15px 14px 15px 19px;
  border: 1px solid var(--line);
  border-left: 3px solid #6d4733;
  border-radius: 8px;
  background: #202222;
}
.audit-entry + .audit-entry { margin-top: 8px; }
.audit-entry > div { width: 100%; min-width: 0; }
.audit-entry b { font-size: .78rem; line-height: 1.5; }
.audit-entry small { line-height: 1.6; font-variant-numeric: tabular-nums; }
.audit-entry small strong { color: #e0c2ad; font-weight: 600; }
.audit-entry span,
.audit-entry .audit-detail {
  display: block;
  margin-top: 9px;
  color: #c4c8c0;
  font-size: .73rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.audit-entry details { margin-top: 10px; }
.audit-entry details summary { cursor: pointer; color: #ef9c72; font-size: .7rem; }
.audit-entry pre {
  max-height: 280px;
  margin: 9px 0 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid #353835;
  border-radius: 8px;
  background: #171818;
  color: #c8ccc5;
  font: .65rem/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.owner-control-section > .row-actions { flex-wrap: wrap; margin-top: 15px; }
.backup-upload { display: inline-flex; align-items: center; margin: 0; font-size: inherit; }
.backup-upload:hover { border-color: var(--orange); }
.backup-upload:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
#receiptDialog { width: min(94vw, 760px); }
.receipt-viewer { padding: 22px; }
.receipt-viewer .modal-heading { margin-bottom: 20px; }
#receiptDialogTitle { overflow-wrap: anywhere; }
#receiptPreview,
.receipt-viewer img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70dvh;
  object-fit: contain;
  border-radius: 9px;
  background: #131414;
}
#receiptField input[type="file"] { padding: 8px; font-size: .7rem; }
#receiptField input::file-selector-button {
  margin-right: 9px;
  padding: 7px 10px;
  border: 1px solid #474a44;
  border-radius: 6px;
  background: #30332e;
  color: #e1e5dc;
  font: inherit;
  cursor: pointer;
}
#receiptStatus:empty { display: none; }
.workflow-dialog { width: min(94vw, 780px); }
.workflow-dialog textarea,
.report-history textarea {
  display: block;
  width: 100%;
  min-height: 90px;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--black);
  resize: vertical;
  font: inherit;
}
.workflow-dialog .form-grid label { min-width: 0; font-size: .76rem; }
.report-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.report-detail-grid > div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.report-detail-grid small { display: block; color: var(--muted); margin-bottom: 5px; }
@media (max-width: 760px) {
  .report-history-section > .section-heading { align-items: stretch; flex-direction: column; }
  .report-history-section > .section-heading > label { width: 100%; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 14px; }
  .history-row > div:first-child { grid-column: 1 / -1; }
  .history-row > strong { text-align: left; }
  .history-row > .row-actions { grid-column: 1 / -1; }
  #dailyCloseForm .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dailyCloseForm .form-grid > label:first-child { grid-column: 1 / -1; }
  #finalizeDailyClose { width: 100%; }
  .audit-filters { gap: 10px; padding: 12px; }
  .audit-filters label { flex-basis: calc(50% - 5px); }
  .audit-filters .text-action { min-height: 30px; }
  .receipt-viewer { padding: 16px; }
  .report-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 440px) {
  .owner-control-section > .row-actions { flex-direction: column; align-items: stretch; }
  .backup-upload { justify-content: center; }
  .audit-filters label { flex-basis: 100%; }
  #dailyCloseForm .form-grid { grid-template-columns: minmax(0, 1fr); }
  .history-row { gap: 10px 6px; }
  .history-row > strong { font-size: .75rem; }
  .status-pill { font-size: .6rem; }
}
