/* File: /shared/assets/app-table.css */

.term-tablewrap,
.term-table-overlay{
  --term-table-border-w:1px;
  --table-cell-pad-y:0px;
  --table-cell-pad-x:6px;
  --table-pager-btn-pad-y:2px;
  --table-pager-btn-pad-x:8px;
  --table-pager-btn-min-w:28px;
  --table-pager-field-w:70px;
  --table-pager-field-pad-x:6px;
  --table-setting-gap:4px;
  --table-setting-pad-x:6px;
  --table-settings-menu-min-w:260px;
  --table-settings-menu-pad:6px;
}

.term-tablewrap.grid-outer-box .term-table{
  border:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap:is(
  .grid-outer-none,
  .grid-outer-top,
  .grid-outer-bottom,
  .grid-outer-left,
  .grid-outer-right,
  .grid-outer-x,
  .grid-outer-y
) .term-table{
  border:0;
}

.term-tablewrap.grid-outer-top .term-table,
.term-tablewrap.grid-outer-y .term-table{
  border-top:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap.grid-outer-bottom .term-table,
.term-tablewrap.grid-outer-y .term-table{
  border-bottom:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap.grid-outer-left .term-table,
.term-tablewrap.grid-outer-x .term-table{
  border-left:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap.grid-outer-right .term-table,
.term-tablewrap.grid-outer-x .term-table{
  border-right:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap.grid-inner-none .term-table th,
.term-tablewrap.grid-inner-none .term-table td{
  border-right:0;
}

.term-tablewrap.grid-inner-row .term-table th,
.term-tablewrap.grid-inner-row .term-table td{
  border-right:0;
}

.term-tablewrap.grid-inner-row .term-table tbody td,
.term-tablewrap.grid-inner-both .term-table tbody td{
  border-top:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap{
  white-space:normal;
  margin:0;
  --table-sticky-h:0px;
  --table-sticky-top:0px;
}

.term-tablewrap .term-table-track{
  min-width:100%;
  width:max-content;
}

.term-tablewrap .term-table-sticky{
  position:sticky;
  top:var(--table-sticky-top);
  z-index:30;
  width:100%;
  contain:inline-size;
  margin:0;
  padding:0;
  border:var(--term-table-border-w) solid var(--border);
  border-top-color:transparent;
  background:var(--panel);
}

.term-tablewrap .term-table-sticky::before{
  content:"";
  position:absolute;
  top:calc(-1 * var(--term-table-border-w));
  right:calc(-1 * var(--term-table-border-w));
  left:calc(-1 * var(--term-table-border-w));
  z-index:1;
  height:0;
  border-top:var(--term-table-border-w) solid var(--border);
  pointer-events:none;
}

.term-tablewrap .term-table-section{ min-width:0; }

.term-tablewrap .term-table-sections-inline{
  display:flex;
  align-items:stretch;
  flex-wrap:nowrap;
  gap:0;
}

.term-tablewrap .term-table-sections-stack{
  display:flex;
  flex-direction:column;
  gap:0;
}

.term-tablewrap .term-table-sections-inline > .term-table-section:not([hidden]) ~ .term-table-section:not([hidden]){
  border-left:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap .term-table-sections-stack > .term-table-section:not([hidden]) ~ .term-table-section:not([hidden]){
  border-top:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap .term-tablepager{ margin:0; }

.term-tablewrap .term-tablepager-controls{
  display:flex;
  align-items:stretch;
}

.term-tablewrap .term-tablepager .pager-btn{
  border:0;
  border-radius:0;
  padding:var(--table-pager-btn-pad-y) var(--table-pager-btn-pad-x);
  min-width:var(--table-pager-btn-min-w);
  line-height:1;
}

.term-tablewrap .term-tablepager-controls .pager-btn + .pager-btn{
  border-left:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap .term-tablepager .pager-btn:active{ transform:none; }

.term-tablewrap .term-tablepager-info{
  flex:1 1 auto;
  min-width:0;
  padding:0 8px;
  display:flex;
  align-items:center;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.term-tablewrap .term-tablepager .pager-field{
  border:0;
  outline:none;
  background:transparent;
  color:var(--fg);
  font-family:inherit;
  font-size:inherit;
  padding:0 var(--table-pager-field-pad-x);
  margin:0;
  width:var(--table-pager-field-w);
  line-height:1;
}

.term-tablewrap .term-tablepager .pager-field::placeholder{
  color:var(--muted);
  opacity:.55;
  font-style:italic;
  text-align:center;
}

.term-tablewrap .term-table-settings-inline{
  display:flex;
  align-items:stretch;
}

.term-tablewrap .term-table-setting{
  display:flex;
  align-items:center;
  gap:var(--table-setting-gap);
  padding:0 var(--table-setting-pad-x);
  border-right:1px solid var(--border);
  white-space:nowrap;
}

.term-tablewrap .term-table-setting:last-child{ border-right:0; }
.term-tablewrap .term-table-setting-title{ color:var(--muted); }

.term-tablewrap .term-table-setting select,
.term-tablewrap .term-table-setting input[type="text"],
.term-tablewrap .term-table-setting input[type="number"]{
  width:auto;
  max-width:90px;
  min-width:50px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--fg);
  font-family:inherit;
  font-size:inherit;
  padding:0 3px;
  outline:none;
}

.term-tablewrap .term-table-settings-inline .term-table-setting select,
.term-tablewrap .term-table-settings-inline .term-table-setting input[type="text"],
.term-tablewrap .term-table-settings-inline .term-table-setting input[type="number"]{
  border:0;
  background:transparent;
}

.term-tablewrap .term-table-setting > .setting-checks-dropdown{ min-width:90px; }
.term-tablewrap .term-table-settings-menu{ position:relative; }

.term-tablewrap .term-table-settings-summary{
  list-style:none;
  cursor:pointer;
  padding:0 8px;
  height:100%;
  display:flex;
  align-items:center;
  color:var(--fg);
  user-select:none;
}

.term-tablewrap .term-table-settings-summary::-webkit-details-marker{ display:none; }

.term-tablewrap .term-table-settings-summary::after{
  content:"";
  width:0;
  height:0;
  margin-left:6px;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
  border-top:5px solid var(--muted);
}

.term-tablewrap .term-table-settings-summary.control-icon::after{ display:none; }

.term-tablewrap .term-table-settings-menu[open] .term-table-settings-summary{
  background:var(--color-hover);
}

.term-tablewrap .term-table-settings-body{
  position:absolute;
  right:0;
  top:100%;
  z-index:50;
  min-width:var(--table-settings-menu-min-w);
  display:grid;
  gap:var(--table-setting-gap);
  padding:var(--table-settings-menu-pad);
  border:1px solid var(--border);
  background:var(--color-surface-alt);
}

.term-tablewrap .term-table-settings-body .term-table-setting{
  justify-content:space-between;
  border-right:0;
  padding:2px 0;
}

.term-tablewrap .table-refresh-btn.is-stale{ color:var(--color-warning); }

.term-tablewrap .term-table-filter-rows{
  width:100%;
  min-width:0;
}

.term-tablewrap .term-table-filter-rows-body{
  display:grid;
  grid-template-columns:minmax(0, 1fr);
  width:fit-content;
  max-width:100%;
  min-width:0;
}

.term-tablewrap .term-table-filter-row{
  width:auto;
  max-width:100%;
  min-width:0;
  min-height:var(--control-icon-box);
  background:var(--panel);
}

.term-tablewrap .term-table-text-filter-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:2px;
  padding:2px 6px;
  white-space:normal;
}

.term-tablewrap .term-table-text-filter-row .filter-term{
  display:inline;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:inherit;
  font:inherit;
  line-height:inherit;
  cursor:pointer;
  appearance:none;
  -webkit-appearance:none;
}

.term-tablewrap .term-table-text-filter-row .filter-term:hover{ text-decoration:underline; }

.term-tablewrap .term-table-value-filter{
  min-width:0;
  align-self:stretch;
}

.term-tablewrap .term-table-value-filter > .term-table-section{
  display:flex;
  align-items:center;
}

.term-tablewrap .term-table-value-filter-title{
  flex:0 0 var(--table-value-filter-title-width, auto);
  width:var(--table-value-filter-title-width, auto);
  padding:2px 6px;
  overflow:hidden;
  color:var(--muted);
  white-space:nowrap;
  text-overflow:ellipsis;
}

.term-tablewrap .term-table-value-filter-presentation{
  min-width:0;
  align-self:stretch;
}

.term-tablewrap .term-table-value-filter.is-filter-disabled > .term-table-value-filter-presentation{
  opacity:.5;
}

.term-tablewrap .term-table-value-filter-stepper{
  min-width:0;
  align-self:stretch;
}

.term-tablewrap .term-table-value-filter-stepper > .term-table-section{
  display:flex;
  align-items:center;
}

.term-tablewrap .term-table-value-filter-step{
  min-width:var(--table-pager-btn-min-w);
  padding:var(--table-pager-btn-pad-y) var(--table-pager-btn-pad-x);
  border:0;
  border-radius:0;
}

.term-tablewrap .term-table-value-filter-current{
  min-width:10ch;
  padding:0 6px;
  justify-content:center;
  text-align:center;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}

.term-tablewrap .term-table-value-filter-trigger{
  padding:2px 6px;
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--fg);
  font:inherit;
  white-space:nowrap;
  cursor:pointer;
  appearance:none;
  -webkit-appearance:none;
}

.term-tablewrap .term-table-value-filter-trigger-title{
  color:var(--muted);
  white-space:pre;
}

.term-tablewrap .term-table-value-filter-trigger::after{
  content:"";
  width:0;
  height:0;
  margin-left:6px;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
  border-top:5px solid var(--muted);
}

.term-tablewrap .term-table-value-filter-trigger:hover,
.term-tablewrap .term-table-value-filter-trigger:focus{
  background:var(--color-hover);
}

.term-tablewrap .term-table-value-filter-toggle{
  flex:0 0 6ch;
  width:6ch;
  min-width:6ch;
  padding:2px 6px;
  border:0;
  border-radius:0;
}

:is(.term-tablewrap, .term-table-overlay) .term-table-value-filter-actions{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:4px;
  padding-bottom:4px;
  border-bottom:1px solid var(--border);
}

:is(.term-tablewrap, .term-table-overlay) .term-table-value-filter-options{
  display:grid;
  grid-template-columns:repeat(
    var(--table-value-filter-option-columns, 1),
    minmax(0, 1fr)
  );
  min-width:0;
  align-items:center;
  gap:2px 12px;
}

:is(.term-tablewrap, .term-table-overlay) .term-table-value-filter-options-row{ grid-auto-flow:row; }

:is(.term-tablewrap, .term-table-overlay) .term-table-value-filter-options-column{
  grid-template-rows:repeat(
    var(--table-value-filter-option-rows, 1),
    auto
  );
  grid-auto-flow:column;
}

:is(.term-tablewrap, .term-table-overlay) .term-table-value-filter-option-button{
  width:100%;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:left;
}

:is(.term-tablewrap, .term-table-overlay) .term-table-value-filter-option-button.is-active{
  border-color:var(--color-accent);
  background:var(--color-selection-bg);
  color:var(--color-selection-text);
}

:is(.term-tablewrap, .term-table-overlay) .term-table-value-filter-action{
  color:var(--color-accent);
  font-weight:700;
}

:is(.term-tablewrap, .term-table-overlay) .term-table-value-filter-action:hover{
  color:var(--color-accent);
}

.term-tablewrap .term-table-value-filter-button-list{
  display:flex;
  align-items:stretch;
  align-self:stretch;
  flex-wrap:wrap;
  gap:0;
  min-width:0;
  padding:0;
}

.term-tablewrap .term-table-value-filter-button-item{
  display:inline-flex;
  align-items:stretch;
  flex:0 0 auto;
  white-space:nowrap;
}

.term-tablewrap .term-table-value-filter-button-item.has-divider{
  border-right:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap .term-table-value-filter-button-item > .widget-control{
  padding:2px 3px;
  border:0;
  border-radius:0;
  white-space:nowrap;
}

.term-tablewrap .term-table-value-filter-separator{
  display:inline-flex;
  align-items:center;
  padding:0;
  color:var(--muted);
  white-space:pre;
  user-select:none;
}

.term-tablewrap .term-table{
  width:max-content;
  min-width:100%;
  border-collapse:collapse;
  border:0;
  background:var(--panel);
  color:var(--fg);
  font-size:inherit;
  table-layout:auto;
}

.term-tablewrap.has-table-top.grid-outer-box .term-table{ border-top:0; }
.term-tablewrap .term-table.is-frozen{ table-layout:fixed; }

.term-tablewrap .term-table th,
.term-tablewrap .term-table td{
  border:none;
  border-right:var(--term-table-border-w) solid var(--border);
  padding:var(--table-cell-pad-y) var(--table-cell-pad-x);
  text-align:left;
  vertical-align:top;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.term-tablewrap.grid-inner-col .term-table th:first-child,
.term-tablewrap.grid-inner-col .term-table td:first-child,
.term-tablewrap.grid-inner-both .term-table th:first-child,
.term-tablewrap.grid-inner-both .term-table td:first-child{
  border-left:var(--term-table-border-w) solid var(--border);
}

.term-tablewrap .term-table th{ position:relative; }

.term-tablewrap .term-table thead th{
  background:var(--color-surface-alt);
  position:sticky;
  top:calc(var(--table-sticky-top) + var(--table-sticky-h) - var(--term-table-border-w));
  z-index:25;
}

.term-tablewrap .term-table thead th.sortable{
  cursor:pointer;
  padding-right:16px;
}

.term-tablewrap .term-table thead th.sort-asc::after{
  content:"\25B2";
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:var(--font-size);
}

.term-tablewrap .term-table thead th.sort-desc::after{
  content:"\25BC";
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:var(--font-size);
}

.term-tablewrap .term-table td.is-num{ font-variant-numeric:tabular-nums; }

.term-tablewrap .term-table td.center,
.term-tablewrap .term-table th.center{ text-align:center; }

.term-tablewrap .term-table td.align-left,
.term-tablewrap .term-table th.align-left{ text-align:left; }

.term-tablewrap .term-table td.align-center,
.term-tablewrap .term-table th.align-center{ text-align:center; }

.term-tablewrap .term-table td.align-right,
.term-tablewrap .term-table th.align-right{ text-align:right; }

.term-tablewrap .term-table td.is-num .num-field{
  display:inline-block;
  line-height:inherit;
  vertical-align:top;
  text-align:right;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:100%;
}

.term-tablewrap .term-table a.cell-link,
.term-tablewrap .term-table button.cell-link{
  color:inherit;
  text-decoration:none;
  font-weight:400;
  line-height:inherit;
}

.term-tablewrap .term-table a.cell-link:hover,
.term-tablewrap .term-table button.cell-link:hover{
  text-decoration:none;
  font-weight:600;
  outline:1px solid var(--border);
  outline-offset:-1px;
}

.term-tablewrap .term-table button.cell-link{
  margin:0;
  padding:0;
  border:0;
  background:transparent;
  font:inherit;
  cursor:pointer;
  appearance:none;
  -webkit-appearance:none;
}

.term-tablewrap .term-table tr.is-hit td{
  background:var(--color-selection-bg);
  color:var(--color-selection-text);
}

.term-tablewrap .col-resize-handle{
  position:absolute;
  top:0;
  right:-2px;
  width:6px;
  height:100%;
  cursor:col-resize;
  user-select:none;
  touch-action:none;
}

.term-tablewrap .col-resize-handle:hover{ background:rgba(255,255,255,0.12); }
