/* History (processed files): filter bar, category tabs, card grid, pagination. Shared by the Dashboard and Studio
   (assets/js/davix-h2i-history.js) so the two History tabs are the same. Design-system tokens only. */

/* The filter bar wraps to several rows at narrow widths instead of a second, mobile-only filter UI. */
.hx .filter-bar{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px;align-items:center;}
.hx .filter-input,.hx .filter-select{border:1px solid var(--border);border-radius:8px;padding:8px 10px;font-family:inherit;font-size:12.5px;background:var(--surface);color:var(--text);}
.hx .filter-input-search{flex:1;min-width:180px;}
.hx .filter-input{min-height:42px;border-radius:10px;padding:0 13px;box-sizing:border-box;}
.hx input[type=date].filter-select{min-height:42px;border-radius:10px;}
.hx .filter-select{min-width:0;min-height:42px;border-radius:10px;}

/* the pager bar: its design is shared with the tables (davix-h2i-saved.css), a bordered strip under the grid */
.hx .pagination-bar{margin-top:16px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);}
.hx .pagination-bar:empty{display:none;}

.hx .history-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px;}
.hx .hist-card{border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden;background:var(--surface);}
.hx .hist-thumb{height:98px;position:relative;background-size:cover;background-position:center;background-color:var(--surface-3);}
.hx .hist-thumb-type{display:flex;align-items:center;justify-content:center;color:var(--text-faint);font-weight:800;font-size:13px;letter-spacing:.5px;}
.hx .hist-thumb .exp{position:absolute;inset:0;background:rgba(10,10,12,.55);display:flex;align-items:center;justify-content:center;color:#fff;font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;}
.hx .hist-body{padding:9px 10px 11px;}
.hx .hist-op{font-size:12.5px;font-weight:700;}
.hx .hist-meta{font-size:11px;color:var(--text-faint);margin-top:2px;font-family:var(--font-mono);}
/* the buttons always stay inside the card: the two icon buttons keep their size, Download takes what is left; on a narrow card Download gets a row of its own */
.hx .hist-actions{display:flex;flex-wrap:wrap;gap:6px;margin:0 10px 10px;container-type:inline-size;}
.hx .hist-actions > *{min-width:0;}
.hx .hist-dl{flex:1 1 0;text-align:center;justify-content:center;padding-inline:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.hx .hist-actions .hist-code,.hx .hist-delete{flex:0 0 36px;padding:0;justify-content:center;}
.hx .hist-delete{display:inline-flex;align-items:center;color:var(--text-muted);}
@container (max-width:180px){
  .hx .hist-actions > :first-child{flex:1 1 100%;}
  .hx .hist-actions .hist-code,.hx .hist-delete{flex:1 1 0;}
}
.hx .hist-delete:hover{color:var(--danger);border-color:var(--danger);}
.hx .hist-empty{color:var(--text-faint);font-size:12.5px;grid-column:1/-1;padding:20px 0;}

/* A card opens the file's own page */
.hx .hist-card[data-file-open]{cursor:pointer;transition:border-color .12s,transform .12s;}
.hx .hist-card[data-file-open]:hover,.hx .hist-card[data-file-open]:focus-visible{border-color:var(--accent);outline:none;}
/* while a file's page is open the History heading above it steps aside */
.hx-detail-open > .hx-pagehead,.hx-detail-open > .page-head{display:none;}
.hx .dp-preview{display:flex;justify-content:center;align-items:center;padding:14px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-2);}
.hx .dp-preview img{max-width:100%;height:auto;display:block;border-radius:0;}   /* the picture exactly as it is: no corners added */
.hx .dp-nopreview{display:flex;flex-direction:column;align-items:center;gap:4px;padding:30px 12px;font-weight:800;font-size:18px;letter-spacing:.6px;color:var(--text-faint);}
.hx .dp-nopreview .dp-ph{position:relative;display:block;width:96px;height:112px;border-radius:12px;font-style:normal;}
.hx .dp-nopreview>span{font-size:11.5px;font-weight:500;letter-spacing:0;font-family:var(--font-mono);}

/* a text result: the text itself fills the preview box */
.hx .dp-preview.dp-text{display:block;padding:26px 30px;}
@media (max-width:640px){ .hx .dp-preview.dp-text{padding:18px 16px;} }
.hx .hist-thumb-pdf{background:#fff;overflow:hidden;}
.hx .hist-thumb-pdf canvas{width:100%;height:100%;object-fit:cover;object-position:top;display:block;}
.hx .dp-textview{width:100%;min-width:0;text-align:left;}
.hx .dp-maintext{white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.6;color:var(--text);}
.hx .hx-dl{display:grid;grid-template-columns:minmax(110px,max-content) minmax(0,1fr);gap:8px 16px;margin:0;font-size:13px;}
.hx .hx-dl dt{color:var(--text-muted);font-weight:600;font-size:12px;}
.hx .hx-dl dd{margin:0;min-width:0;overflow-wrap:anywhere;}
.hx .hx-dl.nested{padding-left:12px;border-left:2px solid var(--border);}
.hx .hx-text{white-space:pre-wrap;line-height:1.55;}
.hx .hx-list{margin:0;padding-left:18px;}
.hx .hx-card{border:1px solid var(--border);border-radius:8px;padding:8px 10px;margin:0 0 6px;background:var(--surface);}
@media (max-width:520px){ .hx .hx-dl{grid-template-columns:minmax(0,1fr);gap:2px 0;} .hx .hx-dl dd{margin-bottom:8px;} }
.hx .dp-json{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font-family:var(--font-mono);font-size:12px;line-height:1.5;color:var(--text-muted);}
.hx .dp-json-more{margin-top:14px;padding-top:14px;border-top:1px solid var(--border);}
.hx .hist-thumb-contain{background-size:contain;background-repeat:no-repeat;}
.hx .hist-thumb-text{background:var(--surface-2);overflow:hidden;display:block;}
.hx .hist-snippet{margin:0;padding:8px 10px;font-family:var(--font-mono);font-size:8.5px;line-height:1.35;color:var(--text-muted);white-space:pre-wrap;overflow:hidden;height:100%;box-sizing:border-box;text-align:left;font-weight:400;letter-spacing:0;}
/* a PDF on the file's page: its pages, one under the other */
.hx .dp-preview.dp-pdf{display:block;padding:14px;}
.hx .dp-pdfpages{display:flex;flex-direction:column;align-items:center;gap:12px;}
.hx .dp-pdfpages canvas{background:#fff;box-shadow:0 2px 14px rgba(0,0,0,.35);border-radius:2px;}
.hx .dp-pdfmore{font-size:12px;padding:4px 0;}
.hx .dp-filetext{margin:0;width:100%;white-space:pre-wrap;overflow-wrap:anywhere;font-family:var(--font-mono);font-size:12px;line-height:1.55;color:var(--text);}
.hx .pv-stage{height:min(56vh,700px);}

.hx .hist-app{font-size:11px;color:var(--text-muted,var(--text-faint));margin-top:2px;}
.hx .hist-app-unknown{color:var(--text-faint);font-style:italic;}

/* Filters: one button; the controls live in a panel that opens under it and filter the list as they change. */
.hx .filter-top{display:flex;justify-content:flex-end;margin-bottom:10px;}
.hx .filter-toggle.on{border-color:var(--accent);color:var(--accent-strong,var(--accent));}
.hx .filter-panel{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px;padding:12px;border:1px solid var(--border);border-radius:12px;background:var(--surface);align-items:center;}
.hx .filter-panel[hidden]{display:none;}
.hx .filter-panel>[hidden]{display:none;}
.hx .filter-panel{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 10px;}
.hx .filter-panel .filter-input-search{grid-column:1/-1;min-width:0;}
.hx .filter-panel .filter-reset{grid-column:1/-1;justify-self:end;min-height:42px;padding:0 18px;background:var(--surface-3);border-color:var(--border-strong);color:var(--text);font-weight:600;}
.hx .filter-panel .filter-reset:hover{background:var(--border-strong);}
@media (max-width:560px){
  
  .hx .filter-panel{grid-template-columns:minmax(0,1fr);} .hx .filter-panel>*{width:100%;box-sizing:border-box;} .hx .filter-panel .filter-reset{justify-self:stretch;}
}

/* ONE Filters button for every list of the apps (Workspace, History, Jobs, Saved, Capabilities): slim, like a small button; on a phone only the icon and the number of filters that are on */
.filter-toggle{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:34px;min-height:34px;padding:0 12px;border-radius:9px;font-size:13px;font-weight:600;line-height:1;}
.filter-toggle svg{width:15px;height:15px;flex:none;}
.filter-toggle.on{border-color:var(--accent);color:var(--accent-strong,var(--accent));}
.filter-toggle .filter-count{min-width:16px;height:16px;padding:0 4px;border-radius:99px;background:var(--accent);color:#fff;font-size:10.5px;font-weight:700;line-height:16px;text-align:center;display:inline-block;box-sizing:border-box;}
.filter-toggle .filter-count[hidden]{display:none;}
.filter-top{display:flex;justify-content:flex-end;}
@media (max-width:560px){
  .filter-toggle{padding:0 10px;gap:5px;}
  .filter-toggle .fl-lbl{display:none;}
  .hx .filter-top{justify-content:flex-end;width:auto;}
}

/* choosing several cards: the checkbox sits in the corner of the picture */
.hx .hist-card{position:relative;}
.hx [data-hx="list"] .bk-bar{margin-top:14px;}
