/* Tables (ui-table.js, Tabulator): a quiet header with compact filters under each column title.
   Text filters show a search icon and "Filter…", choice lists a chevron and "All"; a filter in use is tinted so a
   filtered table is noticed. Applies to every {% ui_table %}. */

.ui-table.tabulator .tabulator-header { background: #f8fafc; border-bottom: 1px solid var(--ui-border); }
.ui-table.tabulator .tabulator-header .tabulator-col { background: transparent; }
.ui-table.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: .5rem .6rem .45rem; }
.ui-table.tabulator .tabulator-col-title { font-size: .8125rem; font-weight: 600; color: #334155; }

.ui-table.tabulator .tabulator-header-filter { margin-top: .3rem; }

/* text and choice filters */
.ui-table.tabulator .tabulator-header-filter input:not([type="checkbox"]),
.ui-table.tabulator .tabulator-header-filter select {
  box-sizing: border-box; width: 100%; height: 1.75rem; min-height: 0; margin: 0;
  padding: .15rem .5rem .15rem 1.55rem !important;  /* Tabulator puts padding inline on the input */
  font-size: .78rem; font-weight: 400; line-height: 1.2; color: var(--bs-body-color);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat .5rem center / .75rem;
  border: 1px solid #dbe1e8; border-radius: .375rem; box-shadow: none; outline: 0;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.ui-table.tabulator .tabulator-header-filter input::placeholder { color: #94a3b8; opacity: 1; }
.ui-table.tabulator .tabulator-header-filter input:not([type="checkbox"]):hover { border-color: #c3ccd7; }
.ui-table.tabulator .tabulator-header-filter input:not([type="checkbox"]):focus,
.ui-table.tabulator .tabulator-header-filter select:focus {
  border-color: var(--ui-section); box-shadow: 0 0 0 .15rem var(--ui-section-glow);
}
/* a filter in use */
.ui-table.tabulator .tabulator-header-filter input:not([type="checkbox"]):not(:placeholder-shown) {
  background-color: var(--ui-section-soft); border-color: var(--ui-section-line); font-weight: 500;
}

/* choice lists: a chevron on the right instead of the search icon */
.ui-table.tabulator .ui-table__col--choice .tabulator-header-filter input:not([type="checkbox"]) {
  padding-left: .5rem !important; padding-right: 1.4rem !important; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right .45rem center;
}

/* yes / no filters (three states: any, ticked, not ticked) */
.ui-table.tabulator .tabulator-header-filter input[type="checkbox"] {
  width: 1rem; height: 1rem; margin: .375rem auto 0; display: block; cursor: pointer; accent-color: var(--ui-accent);
}

.ui-table.tabulator .tabulator-header-filter input[type="checkbox"]:indeterminate { opacity: .35; }  /* any: no filter */

/* the choice list that opens under a filter */
.tabulator-edit-list { font-size: .8125rem; border-radius: .375rem; box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .12); }
.tabulator-edit-list .tabulator-edit-list-item { padding: .3rem .6rem; }
.tabulator-edit-list .tabulator-edit-list-item.active,
.tabulator-edit-list .tabulator-edit-list-item:hover { background: var(--bs-primary-bg-subtle); color: var(--bs-body-color); }

/* Plain HTML tables (reports, personal attendance): `table table-sm ui-report-table` gets the same quiet header as
   the Tabulator tables, room to read, figures in columns and small notes as pills. Colours: ui-theme.css. */
.ui-report-table { font-size: .875rem; margin-bottom: 0; }
.ui-report-table > thead > tr > th { padding: .5rem .5rem; font-size: .8125rem; font-weight: 600; white-space: nowrap;
  vertical-align: bottom; }
.ui-report-table > tbody > tr > td { padding: .4rem .5rem; vertical-align: middle; }
.ui-report-table .ui-num { font-variant-numeric: tabular-nums; }
.ui-report-table .ui-sub { display: block; font-size: .75rem; line-height: 1.1; }
.ui-note { display: inline-block; margin: .05rem .25rem .05rem 0; padding: .05rem .45rem; border-radius: 999px;
  font-size: .75rem; line-height: 1.35; white-space: nowrap; }
.ui-today-chip { display: inline-block; margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; font-size: .7rem;
  font-weight: 600; vertical-align: middle; }
