/* Multi-select filter dropdowns and the "FILTERS:" chip row (assets/js/common/filters.js),
   plus the sort-priority badge on sortable headers (drawSortRanksHelper in sorting.js). */

/* A row of filter dropdowns. */
.flt-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* Multi-select: a select-like button, and a panel with a search box and a checkbox list. */
.ms {
    position: relative;
    width: 180px;
}

.ms .ms-btn {
    display: flex;
    align-items: center;
    width: 100%;
    height: 38px;
    padding: 0 30px 0 14px;
    font: inherit;
    font-size: var(--fs-md);
    color: var(--ink-2);
    text-align: left;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398A2B3' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
}

.ms .ms-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ms .ms-btn:hover {
    border-color: var(--line-strong);
}

.ms .ms-btn:focus-visible,
.ms.open .ms-btn {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* Nothing ticked: the "- Status -" placeholder in a faint tone. */
.ms.is-empty .ms-btn {
    color: var(--muted-ink);
}

.ms .ms-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    width: max(100%, 220px);
    padding: 10px 6px 6px 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: 0 12px 28px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .06);
}

.ms.open .ms-panel {
    display: block;
}

.ms .ms-search {
    width: calc(100% - 4px);
    height: 36px;
    margin-bottom: 6px;
    padding: 0 10px;
    font: inherit;
    font-size: var(--fs-sm);
    color: var(--ink);
    border: 1.5px solid var(--primary-soft-2);
    border-radius: var(--r-sm);
}

.ms .ms-search:focus {
    outline: none;
    border-color: #A4BCFD;
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.ms .ms-list {
    max-height: 230px;
    overflow-y: auto;
    padding-right: 4px;
}

.ms .ms-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    font-size: var(--fs-sm);
    color: var(--ink-2);
    border-radius: var(--r-xs);
    cursor: pointer;
}

.ms .ms-opt:hover {
    background: var(--surface-3);
}

.ms .ms-opt input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.ms .ms-none {
    padding: 8px 6px;
    font-size: var(--fs-sm);
}

/* "FILTERS:" row of chips under the heading, one per filter in use. */
.flt-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: -4px 0 14px;
}

.flt-label {
    padding: 5px 10px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #db2777;
    background: #fdf2f8;
    border: 1px solid rgba(219, 39, 119, .18);
    border-radius: var(--r-xs);
    line-height: 1;
}

.flt-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.flt-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 4px 3px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-xs);
}

.flt-pill .flt-cat {
    padding-right: 8px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--ink-2);
    border-right: 1px solid var(--line);
    line-height: 1.2;
}

.flt-pill .flt-vals {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.flt-pill .flt-val {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: #db2777;
    background: #fdf2f8;
    border: 1px solid rgba(219, 39, 119, .12);
    border-radius: var(--r-pill);
    line-height: 1;
}

.flt-val .flt-x {
    padding: 0;
    font: inherit;
    font-size: var(--fs-xs);
    color: inherit;
    background: none;
    border: none;
    opacity: .7;
    cursor: pointer;
    line-height: 1;
}

.flt-val .flt-x:hover {
    opacity: 1;
}

.flt-clear {
    padding: 5px 12px;
    font: inherit;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid var(--danger-line);
    border-radius: var(--r-pill);
    cursor: pointer;
    line-height: 1;
}

.flt-clear:hover {
    background: #fee4e2;
}

.flt-chips .flt-count {
    margin-left: auto;
    font-size: var(--fs-xs);
}

/* Sort priority beside a sorted header's arrow: 1 solid, later ones lighter. */
th.sortable-header .sort-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 15px;
    margin-left: 4px;
    padding: 0 4px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    color: #fff;
    background: var(--info);
    border-radius: var(--r-pill);
    vertical-align: middle;
    line-height: 1;
}

th.sortable-header .sort-rank.secondary {
    background: #84ADFF;
}

@media (max-width: 900px) {
    .flt-bar .ms {
        flex: 1 1 140px;
        width: auto;
        min-width: 0;
    }
}

/* ── The date-range button (Manager Review → Work list, Dashboard) ───────────────
   A button that opens the date-range picker (daterangepicker): the calendar icon, the range or
   "All dates", and × to clear it. */
.wl-range {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    font-size: var(--fs-sm);
    color: var(--ink-3);
    cursor: pointer;
    user-select: none;
}

.wl-range:hover,
.wl-range:focus-visible {
    border-color: var(--primary);
    outline: none;
}

.wl-range.is-set {
    color: var(--ink);
    border-color: var(--primary);
}

.wl-range__ico {
    width: 15px;
    height: 15px;
    color: var(--muted-ink);
}

.wl-range__x {
    border: none;
    background: none;
    padding: 0 2px;
    font-size: var(--fs-xl);
    line-height: 1;
    color: var(--muted-ink);
    cursor: pointer;
}

.wl-range__x:hover {
    color: var(--danger);
}

/* ---------- Date-range picker: the library's standard look, plus "All dates" ----------
   (render.js patRangeAll). While no range is set, "All dates" is the chosen preset and no
   day shows as selected. The library's stylesheet loads after this one, hence "body". */
body .daterangepicker .ranges li[data-range-key="All dates"] {
    border-bottom: 1px solid #ddd;
}
body .daterangepicker.is-all td.in-range,
body .daterangepicker.is-all td.active,
body .daterangepicker.is-all td.active:hover {
    background-color: #fff;
    border-color: transparent;
    color: inherit;
}
body .daterangepicker.is-all td.available:hover {
    background-color: #eee;
}
