/* Launch history and its per-account detail view. */
.launch-history, .lh-dialog {
  --lh-line: #36393c;
  --lh-muted: #b2b8c0;
  --lh-row-height: clamp(34px, 5.65vh, 47px);
  min-width: 0;
  color: #eceff1;
}
.launch-history .page-heading { gap: 12px; margin-bottom: clamp(12px, 2.9vh, 24px); align-items: center; }
.launch-history .page-heading h1 { margin-bottom: 4px; font-size: clamp(22px, 1.9vw, 29px); font-weight: 550; }
.launch-history .page-heading p { color: var(--lh-muted); font-size: 12px; }
.launch-history .heading-actions { display: flex; align-items: center; gap: 8px; }
.launch-history .heading-actions .btn { min-height: 34px; font-size: 12px; white-space: nowrap; }
.launch-history .heading-actions .btn-primary { background: #087bf2; border-color: #2788ed; color: white; }
.launch-history .heading-actions .btn-primary:hover { background: #238cfa; }
.lh-tabs {
  display: flex; gap: clamp(4px, 1.3vw, 23px); align-items: stretch; margin-bottom: clamp(11px, 3.1vh, 24px);
  border-bottom: 1px solid var(--lh-line);
}
.lh-tab {
  position: relative; min-height: 36px; padding: 5px clamp(7px, 1.4vw, 21px) 10px; margin: 0;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent;
  color: #c7ccd0; font: inherit; font-size: clamp(11px, .98vw, 14px); line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.lh-tab + .lh-tab::before {
  position: absolute; top: 20%; left: calc(-1 * clamp(2px,.65vw,11px)); width: 1px; height: 36%;
  content: ""; background: #2b2e31;
}
.lh-tab[aria-pressed="true"], .lh-tab[aria-selected="true"] { color: #fafbfc; border-bottom-color: #21a1f5; }
.lh-tab:hover { color: white; background: rgba(255,255,255,.025); }
.lh-count { margin-left: .45em; font-variant-numeric: tabular-nums; color: #d4d8dd; }
.lh-tab[aria-pressed="true"] .lh-count, .lh-tab[aria-selected="true"] .lh-count { color: #54b9ff; }
.lh-filters {
  display: grid; grid-template-columns: minmax(0,2.45fr) repeat(3,minmax(0,1fr)); gap: clamp(7px,1vw,16px);
  align-items: center; margin-bottom: clamp(12px, 2.6vh, 22px);
}
.lh-filters input, .lh-filters select {
  width: 100%; min-width: 0; height: clamp(32px, 5.3vh, 40px); margin: 0;
  border: 1px solid #41454a; border-radius: 6px; color: #e8eaed; background-color: #1b1d1f;
  padding: 5px 12px; font: inherit; font-size: 12px;
}
.lh-filters select { padding-right: 20px; cursor: pointer; }
.lh-search { display: block; position: relative; min-width: 0; }
.lh-search .icon, .lh-search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--lh-muted); pointer-events: none; }
.lh-search input { padding-left: 36px; }
.lh-table-wrap { min-width: 0; }
.lh-table {
  border-collapse: collapse; width: 100%; table-layout: fixed; margin: 0;
  color: inherit; font-size: clamp(11px,.98vw,14px); line-height: 1.25;
}
.lh-table th, .lh-table td {
  box-sizing: border-box; min-width: 0; vertical-align: middle; text-align: left; font-weight: 400;
  padding: 3px clamp(7px,1vw,16px); border-bottom: 1px solid var(--lh-line);
}
.lh-table thead th {
  height: clamp(38px, 6.7vh, 47px); background: #202224; color: #d9dde0; font-size: clamp(10px,.94vw,13px);
  letter-spacing: 0; line-height: 1.25; text-transform: none;
}
.lh-table th small { display: block; margin-top: 1px; color: var(--lh-muted); font-size: .85em; font-weight: 400; }
.lh-table tbody tr { height: var(--lh-row-height); }
.lh-table tbody tr:hover { background: rgba(222,230,239,.035); }
.lh-table tbody td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-table:not(.lh-detail-table) th:nth-child(1) { width: 14%; }
.lh-table:not(.lh-detail-table) th:nth-child(2) { width: 14%; }
.lh-table:not(.lh-detail-table) th:nth-child(3) { width: 14%; }
.lh-table:not(.lh-detail-table) th:nth-child(4) { width: 9%; }
.lh-table:not(.lh-detail-table) th:nth-child(5) { width: 16%; }
.lh-table:not(.lh-detail-table) th:nth-child(6) { width: 18.5%; }
.lh-table:not(.lh-detail-table) th:nth-child(7) { width: 14.5%; }
.lh-source,.lh-geo,.lh-status,.lh-creative { display: inline-flex; min-width: 0; max-width: 100%; align-items: center; vertical-align: middle; }
.lh-source > * + *, .lh-geo > * + *, .lh-status > * + *, .lh-creative > * + * { margin-left: .65em; }
.lh-source > svg { width: 19px; height: 19px; flex: none; }
.lh-status { white-space: normal; }
.lh-status .lh-dot { width: 8px; height: 8px; border-radius: 50%; background: #92989d; flex: none; }
.lh-status[data-tone=success] .lh-dot, .lh-status[data-tone=paused] .lh-dot { background: #29c579; }
.lh-status[data-tone=warning] .lh-dot { background: #e8af31; }
.lh-status[data-tone=error] .lh-dot { background: #eb545f; }
.lh-progress { display: inline-flex; vertical-align: middle; align-items: center; width: 100%; max-width: 236px; font-variant-numeric: tabular-nums; }
.lh-progress progress {
  display: block; flex: 1; min-width: 0; width: 0; height: 7px; border: 0; border-radius: 8px;
  overflow: hidden; background: #393c40; accent-color: #1487f6;
}
.lh-progress progress::-webkit-progress-bar { background: #393c40; }
.lh-progress progress::-webkit-progress-value { background: #1487f6; border-radius: 8px; }
.lh-progress progress::-moz-progress-bar { background: #1487f6; border-radius: 8px; }
.lh-progress > span { flex: none; margin-left: 9px; white-space: nowrap; }
.lh-actions { display: flex; gap: clamp(2px,.5vw,9px); align-items: center; justify-content: flex-end; }
.lh-actions button,.lh-copy,.lh-dialog-head button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0;
  background: transparent; color: #d5dbe2; font: inherit; line-height: 1.15; cursor: pointer; border-radius: 5px;
}
.lh-actions button, .lh-copy { min-height: 29px; padding: 3px 4px; }
.lh-actions button:hover, .lh-copy:hover, .lh-dialog-head button:hover { color: #83c9ff; background: rgba(39,145,241,.09); }
.lh-actions button:disabled, .lh-copy:disabled { opacity: .5; cursor: default; }
.lh-actions .lh-action { min-width: 27px; padding: 3px; }
.lh-action svg, .lh-copy svg { flex: none; width: 15px; height: 15px; }
.lh-more svg { width: 12px; height: 12px; flex: none; }
.lh-pager { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 6px; font-size: 12px; color: var(--lh-muted); }
.lh-pager[hidden], .launch-history [hidden], .lh-dialog [hidden] { display: none !important; }
.lh-pager button { min-height: 26px; padding: 2px 8px; }
.lh-dialog {
  --lh-row-height: clamp(35px,6.08vh,50px);
  position: fixed; top: 50%; left: 50%; right: auto; bottom: auto; margin: 0; transform: translate(-50%, -50%);
  padding: 0; width: min(1200px,80vw); max-width: calc(100vw - 24px); max-height: min(90vh,890px);
  max-height: min(90dvh,890px); box-sizing: border-box;
  border: 1px solid #464a4e; border-radius: 10px; background: #202326; color: #eef0f3;
  box-shadow: 0 18px 65px #0008;
}
.lh-dialog::backdrop { background: rgba(6,8,11,.72); backdrop-filter: blur(2px); }
.lh-dialog-head,.lh-dialog-meta,.lh-modal-body { margin: 0 clamp(10px,1.15vw,20px); }
.lh-dialog-head {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: clamp(10px,2vh,17px) clamp(6px,1vw,15px); border-bottom: 1px solid var(--lh-line);
}
.lh-dialog-head h2 { margin: 0; font-weight: 560; font-size: clamp(18px,1.72vw,26px); }
.lh-dialog-head button { width: 28px; height: 28px; padding: 4px; color: #b4bac1; }
.lh-dialog-head svg { width: 18px; height: 18px; }
.lh-dialog-meta {
  display: flex; align-items: center; min-height: clamp(39px,7vh,56px);
  padding: 5px clamp(6px,1vw,15px); border-bottom: 1px solid var(--lh-line);
  color: #e0e4e8; font-size: clamp(12px,1.2vw,16px);
}
.lh-dialog-meta > * + * { margin-left: .45em; }
.lh-dialog-meta .lh-source svg { width: 21px; height: 21px; }
.lh-modal-body { padding-bottom: clamp(9px,1.6vh,15px); }
.lh-detail-table { font-size: clamp(12px,1.17vw,16px); }
.lh-detail-table thead th { background: transparent; }
.lh-detail-table th:nth-child(1) { width: 17%; }
.lh-detail-table th:nth-child(2) { width: 18%; }
.lh-detail-table th:nth-child(3) { width: 22%; }
.lh-detail-table th:nth-child(4) { width: 25%; }
.lh-detail-table th:nth-child(5) { width: 18%; }
.lh-detail-table .lh-thumb { width: calc(var(--lh-row-height) - 8px); height: calc(var(--lh-row-height) - 8px); object-fit: cover; border-radius: 5px; flex: none; background: #282c2f; }
.lh-creative > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-detail-table .lh-copy { justify-content: flex-start; text-align: left; white-space: nowrap; gap: 0; }
.lh-detail-table .lh-copy svg + span { margin-left: 6px; }
.lh-log-fallback {
  position: absolute; z-index: 4; inset: 6px; display: flex; flex-direction: column; align-items: flex-end;
  gap: 8px; padding: 10px; border: 1px solid var(--lh-line); border-radius: 7px; background: #222528;
}
.lh-log-fallback textarea { flex: 1; min-height: 38px; width: 100%; resize: none; font: 12px/1.4 monospace; }
@media (max-width:1100px) {
  .lh-table th,.lh-table td { padding-inline: 6px; }
  .lh-table:not(.lh-detail-table) th:nth-child(6) { width: 19%; }
  .lh-table:not(.lh-detail-table) th:nth-child(7) { width: 14%; }
  .lh-tab { padding-inline: 9px; }
  .lh-actions { gap: 1px; }
  .lh-actions button { padding-inline: 2px; }
  .lh-dialog { width: 92vw; }
}
@media (max-width:710px), (min-width:821px) and (max-width:960px) {
  .launch-history .page-heading { align-items: flex-start; flex-wrap: wrap; }
  .lh-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .lh-search { grid-column: 1/-1; }
  .lh-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 2px; }
  .lh-tab { padding: 5px 2px; font-size: 11px; min-height: 26px; border-radius: 3px 3px 0 0; }
  .lh-tab + .lh-tab::before { display: none; }
  .lh-table:not(.lh-detail-table) { --lh-row-height: 80px; }
  .lh-table:not(.lh-detail-table), .lh-table:not(.lh-detail-table) tbody { display: block; }
  .lh-table:not(.lh-detail-table) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .lh-table:not(.lh-detail-table) tbody tr {
    display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.32fr) minmax(0,1.2fr);
    grid-template-areas: "source profile actions" "geo type status" "date date status";
    align-items: center; column-gap: 6px; row-gap: 2px; border-bottom: 1px solid var(--lh-line); padding: 5px 1px;
  }
  .lh-table:not(.lh-detail-table) tbody td { border: 0; height: auto; padding: 0; min-width: 0; }
  .lh-table td[data-col=source] { grid-area: source; }
  .lh-table td[data-col=profile] { grid-area: profile; }
  .lh-table td[data-col=type] { grid-area: type; }
  .lh-table td[data-col=geo] { grid-area: geo; }
  .lh-table td[data-col=date] { grid-area: date; }
  .lh-table td[data-col=status] { grid-area: status; }
  .lh-table td[data-col=actions] { grid-area: actions; }
  .lh-table td[colspan] { grid-column: 1/-1; }
  .lh-actions { justify-content: end; }
  .lh-actions button { padding: 2px 4px; font-size: 11px; }
  .lh-actions .lh-more { gap: 2px; }
}
@media (max-width:670px) {
  .lh-dialog { width: calc(100vw - 12px); max-width: calc(100vw - 12px); max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); }
  .lh-dialog-meta { flex-wrap: wrap; font-size: 12px; }
  .lh-detail-table { display: block; --lh-row-height: 66px; }
  .lh-detail-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .lh-detail-table tbody { display: block; }
  .lh-detail-table tbody tr { display: grid; grid-template-columns: minmax(0,1.08fr) minmax(0,1fr) auto;
    grid-template-areas: "creative account actions" "date status status"; align-items: center; gap: 3px 7px;
    padding: 4px 0; border-bottom: 1px solid var(--lh-line); }
  .lh-detail-table tbody td { min-width: 0; padding: 0; border: 0; }
  .lh-detail-table td[data-col=creative] { grid-area: creative; }
  .lh-detail-table td[data-col=account] { grid-area: account; }
  .lh-detail-table td[data-col=date] { grid-area: date; }
  .lh-detail-table td[data-col=status] { grid-area: status; }
  .lh-detail-table td[data-col=actions] { grid-area: actions; }
  .lh-detail-table td[colspan] { grid-column: 1/-1; }
  .lh-detail-table .lh-thumb { width: 27px; height: 27px; }
  .lh-detail-table .lh-copy { width: 32px; }
  .lh-detail-table .lh-copy > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width:460px) {
  .launch-history .page-heading { gap: 5px; margin-bottom: 8px; }
  .launch-history .page-heading p { font-size: 11px; }
  .launch-history .heading-actions .btn { padding: 5px 9px; font-size: 12px; }
  .lh-tabs,.lh-filters { margin-bottom: 8px; }
  .lh-filters { gap: 5px; }
  .lh-filters select { font-size: 11px; padding-left: 5px; padding-right: 2px; }
  .lh-actions button { gap: 1px; padding-inline: 1px; }
  .lh-copy svg { width: 17px; height: 17px; }
}
@media (max-height:480px) {
  .launch-history .page-heading,.lh-tabs,.lh-filters { margin-bottom: 4px; }
  .launch-history .page-heading { align-items: center; flex-wrap: nowrap; }
  .launch-history .page-heading p { display: none; }
  .lh-filters { grid-template-columns: minmax(0,1.4fr) repeat(3,minmax(0,1fr)); }
  .lh-search { grid-column: auto; }
  .lh-tab { min-height: 24px; padding-block: 3px; }
  .lh-filters input,.lh-filters select { height: 28px; }
  .lh-dialog { max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); }
  .lh-dialog-head { padding-block: 3px; }
  .lh-dialog-meta { min-height: 28px; }
}
@media (max-height:400px) and (min-width:440px) and (max-width:710px) {
  .lh-tabs { display: flex; justify-content: space-between; }
  .lh-tab { padding-inline: 1px; font-size: 10px; }
  .lh-table:not(.lh-detail-table) { --lh-row-height: 58px; }
  .lh-table:not(.lh-detail-table) tbody tr { row-gap: 0; padding-block: 2px; }
}
/* A mixed batch can contain both resumable and pausable jobs. */
.lh-action + .lh-action ~ .lh-more { min-width: 26px; }
.lh-action + .lh-action ~ .lh-more > span {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
