#history-open { width: auto; padding: 10px 18px; margin-bottom: 18px; }
#history-dialog { width: min(1060px, calc(100% - 24px)); max-height: 85dvh; padding: 24px; border: 1px solid #555; border-radius: 8px; background: #303030; color: #fff; }
#history-dialog::backdrop { background: rgb(0 0 0 / 70%); }
#history-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#history-dialog h2 { font-size: 24px; margin: 0; overflow-wrap: anywhere; }
#history-dialog button { width: 40px; min-height: 40px; flex-shrink: 0; background: #bc1823; border-radius: 8px; }
#history-dialog button:hover { background: #98121b; }
#history-message { line-height: 1.5; }
#history-dialog table { width: 100%; border-collapse: collapse; table-layout: fixed; }
#history-dialog th, #history-dialog td { border: 1px solid #777; padding: 12px; text-align: left; line-height: 1.5; overflow-wrap: anywhere; }
#history-dialog th { background: #bc1823; }
#history-dialog th:nth-child(1) { width: 17%; }
#history-dialog th:nth-child(2) { width: 24%; }
#history-dialog th:nth-child(3) { width: 12%; }
#history-dialog th:nth-child(5) { width: 16%; }
#history-dialog footer { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 16px; }
.history-status { display: inline-block; padding: 4px 8px; border-radius: 6px; background: #464646; }
.history-status.approved { color: #bcf5d5; background: #214a36; }
.history-status.rejected, .history-status.failed { color: #ffd4d7; background: #682b32; }
.history-status.processing, .history-status.pending { color: #cce8ff; background: #234562; }
@media (max-width: 600px) {
  #history-dialog { box-sizing: border-box; width: calc(100% - 20px); max-height: 88dvh; padding: 16px; border-radius: 14px; overflow-y: auto; }
  #history-dialog header { gap: 12px; align-items: flex-start; }
  #history-dialog h2 { font-size: 20px; line-height: 1.3; }
  #history-dialog header button { width: 44px; min-height: 44px; margin: 0; padding: 0; }
  #history-message { font-size: 13px; color: #d0d0d0; margin: 12px 0 16px; }
  #history-dialog thead { display: none; }
  #history-dialog table, #history-dialog tbody { display: block; width: 100%; }
  #history-dialog tbody { display: grid; gap: 14px; }
  #history-dialog tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'date status' 'bonus bonus' 'amount amount' 'description description'; gap: 12px; padding: 14px; border: 1px solid #555; border-radius: 12px; background: #262626; }
  #history-dialog td { display: block; width: auto; min-width: 0; box-sizing: border-box; border: 0; padding: 0; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
  #history-dialog td::before { display: block; content: attr(data-label); margin-bottom: 4px; color: #bdbdbd; font-size: 11px; font-weight: 400; letter-spacing: .2px; }
  #history-dialog td:nth-child(1) { grid-area: date; align-self: center; color: #c9c9c9; font-size: 12px; }
  #history-dialog td:nth-child(5) { grid-area: status; align-self: start; max-width: 132px; }
  #history-dialog td:nth-child(1)::before, #history-dialog td:nth-child(5)::before { display: none; }
  #history-dialog td:nth-child(2) { grid-area: bonus; font-size: 15px; font-weight: 600; }
  #history-dialog td:nth-child(3) { grid-area: amount; }
  #history-dialog td:nth-child(3) span { font-size: 20px; font-weight: 700; }
  #history-dialog td:nth-child(4) { grid-area: description; padding-top: 12px; border-top: 1px solid #494949; color: #ededed; }
  #history-dialog .history-status { display: inline-block; padding: 5px 9px; font-size: 12px; line-height: 1.4; border-radius: 7px; }
  #history-dialog footer { justify-content: center; margin-top: 18px; }
  #history-dialog footer button { width: 44px; min-height: 44px; }
}
@media (max-width: 360px) {
  #history-dialog { padding: 12px; }
  #history-dialog tr { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'date' 'status' 'bonus' 'amount' 'description'; gap: 10px; }
}

#bonus-result-toast { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 1000; width: max-content; max-width: calc(100vw - 24px); box-sizing: border-box; padding: 14px 18px; border-radius: 8px; color: #fff; font: 600 14px/1.5 Arial, sans-serif; overflow-wrap: anywhere; box-shadow: 0 4px 18px rgb(0 0 0 / 35%); }
#bonus-result-toast[hidden] { display: none; }
#bonus-result-toast.approved { background: #166534; }
#bonus-result-toast.rejected { background: #b91c1c; }

#bonus-result-toast { padding-right: 52px; }
#bonus-result-toast .bonus-toast-close { position: absolute; top: 2px; right: 2px; width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: #fff; font: 26px/1 Arial, sans-serif; cursor: pointer; }
#bonus-result-toast .bonus-toast-close:hover { background: rgb(255 255 255 / 15%); }
#bonus-result-toast .bonus-toast-close:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
