/* 歷史頁沿用原版排列，互動使用目前的 DataTables 與 jQuery UI。 */
.history-page #div-history .dt-layout-row {
  margin: 0.5em 0;
}
.history-page #div-history .dt-layout-full {
  text-align: start;
  justify-content: flex-start;
}
.history-page #div-history .dt-layout-full > .history-toolbar {
  width: 100%;
  box-sizing: border-box;
  margin-inline: 0;
}
.history-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 4px;
}
.history-toolbar .ui-button,
.history-dialog .ui-button {
  font-size: 11.7333px;
  padding: 0.55em 1em;
  border-color: #d3d3d3;
  background: linear-gradient(#f1f1f1, #e6e6e6);
  color: #555;
}
.history-toolbar .ui-button {
  line-height: 2em;
  padding-block: 0.4em;
}
.history-toolbar .ui-button .fa,
.history-dialog .ui-button .fa {
  margin-inline-end: 5px;
}
.history-page #history td,
.history-page #history th {
  text-align: center;
}
.history-page #history tbody td {
  padding: 9px 8px;
}
.history-page #history form {
  margin: 0;
}
.history-page #history .history-row-action {
  border: 0;
  background: transparent;
  font: inherit;
  color: #111;
  padding: 0;
  margin: 0;
  font-size: 18px;
  cursor: pointer;
}
.history-page #history .history-row-delete:hover {
  color: #c00;
}
.history-page #history .history-row-recover:hover {
  color: #080;
}
.history-page #history input[type="checkbox"] {
  cursor: pointer;
}
.history-page #history tbody tr {
  cursor: pointer;
}
.history-page #history .history-action-cell {
  width: 36px;
}
.history-page #history tbody td:nth-child(2) {
  overflow-wrap: anywhere;
}
.history-dialog {
  font-size: 12px;
  max-width: calc(100vw - 24px);
}
.history-dialog .ui-dialog-titlebar {
  font-size: 13px;
  background: linear-gradient(#f2f2f2, #ddd);
  border-color: #aaa;
}
.history-dialog .ui-dialog-title {
  white-space: normal;
}
.history-dialog .ui-dialog-content {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.history-dialog textarea {
  box-sizing: border-box;
  width: 100%;
  flex: 1;
  min-height: 140px;
  resize: none;
  font: 12px monospace;
}
.history-export-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.history-format-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.history-dialog .history-format-controls label {
  padding: 0.6em;
  font-size: 11px;
}
.history-dialog #history-delete-addresses {
  white-space: pre-line;
  overflow-wrap: anywhere;
  clear: both;
  max-height: 90px;
  overflow: auto;
}
.history-dialog #dialog-delete {
  display: block;
}
.history-page .ui-widget-overlay {
  background: #aaa;
  opacity: 0.3;
}
.history-page #div-history-nosupport img {
  float: left;
  margin: 0 30px;
}
#history-import-error,
#history-error {
  color: #a00;
}

/* 手機沿用同一份表格／操作邏輯；外觀只作用於手機歷史內頁。 */
.mobile-history #div-history-nosupport.none {
  display: none;
}
.mobile-history #div-history-help,
.mobile-history #div-history {
  width: 100%;
  box-sizing: border-box;
}
.mobile-history .history-toolbar .ui-button,
.mobile-history .history-row-action,
.mobile-history .dt-paging-button,
.mobile-history-dialog .ui-button {
  min-height: 44px;
  min-width: 44px;
  font-size: 14px;
  white-space: normal;
}
.mobile-history .history-toolbar {
  padding-inline: 0;
}
.mobile-history #select_domain,
.mobile-history .dt-input {
  max-width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  font-size: 16px;
}
.mobile-history .dt-layout-row {
  gap: 8px;
}
.mobile-history #history_wrapper .dt-layout-cell {
  min-width: 0;
}
.mobile-history .dt-info {
  white-space: normal;
}
.mobile-history .is-selected {
  background: #e3f1fa !important;
}
.mobile-history-dialog {
  /* 舊手機主題將 .ui-dialog 設為透明；此處只修正歷史視窗的同名衝突。 */
  background: #fff !important;
  color: #333;
  font-size: 16px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
}
.mobile-history-dialog .ui-dialog-titlebar {
  font-size: 16px;
  min-height: 44px;
  box-sizing: border-box;
  padding-inline-end: 50px;
}
.mobile-history-dialog .ui-dialog-titlebar-close {
  top: 0;
  left: auto;
  right: auto;
  inset-inline-end: 0;
  width: 44px;
  height: 44px;
  margin: 0;
  font-size: 0;
  text-indent: 0;
}
.mobile-history-dialog .ui-dialog-titlebar-close::before {
  content: "×";
  display: block;
  font-size: 24px;
  line-height: 40px;
}
.mobile-history-dialog .ui-dialog-titlebar-close .ui-button-icon,
.mobile-history-dialog .ui-dialog-titlebar-close .ui-button-icon-space {
  display: none;
}
.mobile-history-dialog textarea {
  font-size: 16px;
  min-height: 100px;
}
.mobile-history-dialog .ui-dialog-content {
  background: #fff;
  max-height: calc(100dvh - 150px);
}
.mobile-history-dialog .history-format-controls label {
  font-size: 14px;
  min-height: 44px;
  box-sizing: border-box;
}
.mobile-history-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
  display: flex;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .mobile-history #history,
  .mobile-history #history thead,
  .mobile-history #history tbody {
    display: block;
    width: 100% !important;
  }
  .mobile-history #history tfoot,
  .mobile-history #history thead th:first-child,
  .mobile-history #history thead th:nth-child(4),
  .mobile-history #history thead th:nth-child(5) {
    display: none;
  }
  .mobile-history #history thead tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .mobile-history #history thead th {
    width: auto !important;
    min-height: 44px;
    box-sizing: border-box;
    padding: 10px 4px;
    text-align: start;
  }
  .mobile-history #history tbody tr {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 44px 44px;
    border-bottom: 1px solid #ddd;
    padding: 8px 0;
    align-items: center;
  }
  .mobile-history #history tbody td {
    display: block;
    width: auto !important;
    box-shadow: none;
    border: 0;
    padding: 4px 2px;
  }
  .mobile-history #history tbody td:first-child {
    grid-column: 1;
    grid-row: 1 / 3;
  }
  .mobile-history #history input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin: 0;
  }
  .mobile-history #history tbody td:nth-child(2) {
    grid-column: 2;
    text-align: start;
    font-weight: bold;
  }
  .mobile-history #history tbody td:nth-child(3) {
    grid-column: 2;
    text-align: start;
    font-size: 13px;
    overflow-wrap: anywhere;
  }
  .mobile-history #history tbody td:nth-child(4),
  .mobile-history #history tbody td:nth-child(5) {
    grid-row: 1 / 3;
  }
  .mobile-history #history tbody td:nth-child(4) {
    grid-column: 3;
  }
  .mobile-history #history tbody td:nth-child(5) {
    grid-column: 4;
  }
  .mobile-history #history tbody td.dt-empty {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
    padding: 20px 4px;
  }
}
