/* ============================================================================
   Work queue (Components/Pages/WorkQueue.razor). Loads after flashfix-app.css.
   ----------------------------------------------------------------------------
   One list of what a person has to do, read top-down by urgency: the lane
   tiles say how much is late, due today, coming up and undated, and double as
   filters; below them each lane is a single bordered list of rows, every row
   one job with one action. Managers get a second view read by problem, with
   who has what beside it. Colour carries meaning only: red is late, brass is
   today, and each kind of work keeps one tint so a row can be read at a glance.
   Everything here is prefixed wq- (flashfix-app.css is one global sheet).
   ============================================================================ */

.wq { --wq-late: var(--score-danger); --wq-late-ink: color-mix(in srgb, var(--score-danger), var(--text) 18%); --wq-brass-ink: var(--brass); }
.light .wq { --wq-brass-ink: #8a6212; }

/* ---- Sidebar: the count beside "Work queue" (shape and rail placement come from .notif-badge) ---- */
.snav-link .wq-nav-badge.is-late { background: var(--score-danger); color: #fff; }

/* ---- Page bar: the two views and their counts ---- */
.wq-views button { display: inline-flex; align-items: center; gap: 6px; }
.wq-tab-count { min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 999px;
    background: color-mix(in srgb, var(--text), transparent 84%); color: var(--text);
    font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 700; line-height: 1; }
.wq-tab-count.bad { background: var(--score-danger); color: #fff; }
.wq-tab-count.warn { background: var(--brass); color: var(--on-accent); }

/* ---- Hero: a sentence, then the lanes as tiles ---- */
.wq-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px 28px; margin: 2px 0 18px; }
.wq-hello { min-width: 0; }
.wq-hello h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.wq-hello p { margin: 0; font-size: 13px; color: var(--muted); max-width: 72ch; }

.wq-lanes { display: grid; grid-template-columns: repeat(4, minmax(118px, 1fr)); gap: 10px; }
.wq-lane {
    --wq-tone: var(--muted);
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "count name" "count hint";
    align-items: center;
    column-gap: 10px;
    padding: 10px 14px 10px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-panel);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s ease, background-color .15s ease;
}
.wq-lane::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--wq-tone); }
.wq-lane.is-overdue { --wq-tone: var(--wq-late); }
.wq-lane.is-today { --wq-tone: var(--brass); }
.wq-lane.is-soon { --wq-tone: var(--chart-primary); }
.wq-lane.is-empty { --wq-tone: var(--border); }
.wq-lane:hover { border-color: color-mix(in srgb, var(--wq-tone), var(--border) 45%); }
.wq-lane:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wq-lane.active { border-color: var(--wq-tone); background: color-mix(in srgb, var(--wq-tone), var(--surface-panel) 90%); }
.wq-lane-count { grid-area: count; font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.wq-lane.is-overdue:not(.is-empty) .wq-lane-count { color: var(--wq-late-ink); }
.wq-lane.is-today:not(.is-empty) .wq-lane-count { color: var(--wq-brass-ink); }
.wq-lane.is-empty .wq-lane-count { color: var(--muted); }
.wq-lane-name { grid-area: name; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.wq-lane small { grid-area: hint; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Main column and its side panels ---- */
.wq-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.wq-main { min-width: 0; }
.wq-aside { display: grid; gap: 14px; min-width: 0; }

/* ---- Toolbar: kind chips and search ---- */
.wq-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.wq-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wq-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
    border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--muted);
    font-size: 12px; font-weight: 500; cursor: pointer; transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.wq-chip span { font-family: 'JetBrains Mono', monospace; font-size: 11px; opacity: .75; }
.wq-chip:hover { color: var(--text); }
.wq-chip.active { color: var(--text); border-color: color-mix(in srgb, var(--brass), transparent 45%); background: color-mix(in srgb, var(--brass), transparent 86%); }
.wq-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wq-search {
    display: flex; align-items: center; gap: 7px; height: 30px; min-width: 250px; margin: 0; padding: 0 10px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface-panel); color: var(--muted);
}
.wq-search .ui-icon { width: 13px; height: 13px; }
.wq-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12.5px; }
.wq-search input::placeholder { color: var(--muted); }
.wq-search:focus-within { border-color: color-mix(in srgb, var(--brass), transparent 40%); box-shadow: 0 0 0 3px var(--focus-ring); }

.wq-filter-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* ---- A lane, or a team problem: heading then one bordered list ---- */
.wq-section { margin-bottom: 22px; }
.wq-section-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 2px 8px; }
.wq-section-head h3 { margin: 0; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.wq-section.is-overdue .wq-section-head h3 { color: var(--wq-late-ink); }
.wq-section.is-today .wq-section-head h3 { color: var(--wq-brass-ink); }
.wq-section-note { font-size: 11.5px; color: var(--muted); opacity: .8; }
.wq-section-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px;
    background: color-mix(in srgb, var(--wq-late), transparent 88%); color: var(--wq-late-ink); }
.wq-section.is-watch .wq-section-icon { background: color-mix(in srgb, var(--chart-primary), transparent 86%); color: var(--chart-primary); }
.wq-section-icon .ui-icon { width: 12px; height: 12px; }

.wq-count { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px;
    background: var(--surface-control); color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }
.wq-count.bad { background: color-mix(in srgb, var(--wq-late), transparent 86%); color: var(--wq-late-ink); }

.wq-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-panel); overflow: hidden; }

/* ---- One row: kind, what and who, (owner), when, action ---- */
.wq-item {
    position: relative;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto auto;
    grid-template-areas: "kind text when actions";
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-soft);
    transition: background-color .14s ease;
}
.wq-item:first-child { border-top: 0; }
.wq-item:hover { background: var(--surface-hover); }
.wq-list.is-team .wq-item { grid-template-columns: 32px minmax(0, 1fr) minmax(110px, 160px) auto auto; grid-template-areas: "kind text owner when actions"; }

/* A late row is marked at its edge; the colour of the due time says the rest. */
.wq-item.is-overdue:not(.is-watch)::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--wq-late); }
.wq-item.is-next { background: color-mix(in srgb, var(--brass), var(--surface-panel) 93%); }
.wq-item.is-next::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brass); }

.wq-kind { --wq-tone: var(--chart-primary); grid-area: kind; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px;
    background: color-mix(in srgb, var(--wq-tone), transparent 86%); color: var(--wq-tone); }
.wq-kind .ui-icon { width: 15px; height: 15px; }
.wq-kind.is-calls { --wq-tone: var(--green); }
.wq-kind.is-follow-ups { --wq-tone: var(--brass); }
.wq-kind.is-orders { --wq-tone: var(--purple); }
.wq-kind.is-cases { --wq-tone: var(--orange); }
.light .wq-kind.is-follow-ups { --wq-tone: #8a6212; }

.wq-text { grid-area: text; min-width: 0; display: grid; gap: 2px; }
.wq-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wq-title b { min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wq-sub { min-width: 0; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wq-sep { margin: 0 5px; opacity: .6; }

.wq-tag { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--surface-control); color: var(--muted); font-size: 10.5px; font-weight: 600; }
.wq-tag.is-money { font-family: 'JetBrains Mono', monospace; color: var(--wq-brass-ink); background: color-mix(in srgb, var(--brass), transparent 88%); }

.wq-owner { grid-area: owner; display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; }
.wq-owner > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wq-owner.is-nobody { color: var(--muted); font-style: italic; }

.wq-avatar { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
    background: color-mix(in srgb, var(--chart-primary), transparent 72%); color: var(--text); font-size: 9.5px; font-weight: 700; font-style: normal; letter-spacing: .02em; }
.is-nobody .wq-avatar { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }

.wq-when { grid-area: when; font-size: 11.5px; color: var(--muted); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.wq-item.is-overdue:not(.is-watch) .wq-when { color: var(--wq-late-ink); font-weight: 600; }
.wq-item.is-today .wq-when { color: var(--text); font-weight: 500; }

.wq-actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.wq-actions .btn { white-space: nowrap; }
.wq-call { width: 26px; padding: 0; display: inline-grid; place-items: center; }
.wq-call .ui-icon { width: 12px; height: 12px; }

.wq-more { margin-top: 8px; padding: 4px 2px; border: 0; background: none; color: var(--wq-brass-ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.wq-more:hover { text-decoration: underline; }

.wq-scope { margin: 18px 2px 0; max-width: 80ch; font-size: 11.5px; color: var(--muted); }

.wq-nomatch { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; padding: 22px;
    border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: 12.5px; }

/* ---- All clear ---- */
.wq-clear { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.wq-clear b { display: block; font-size: 14px; }
.wq-clear span:not(.wq-clear-icon) { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.wq-clear-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
    background: color-mix(in srgb, var(--score-good), transparent 86%); color: var(--score-good); }
.wq-clear-icon.is-calm { background: color-mix(in srgb, var(--brass), transparent 86%); color: var(--wq-brass-ink); }
.wq-clear-icon .ui-icon { width: 19px; height: 19px; }

/* ---- Side panels ---- */
.wq-card { padding: 14px 16px; }
.wq-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--wq-brass-ink); }
.wq-card-head .ui-icon { width: 14px; height: 14px; }
.wq-card-head h3 { flex: 1; min-width: 0; margin: 0; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.wq-card-note, .wq-card-empty { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.wq-card-empty { margin-bottom: 0; }
.wq-card-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; padding: 0; border: 0; background: none;
    color: var(--wq-brass-ink); font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; }
.wq-card-link:hover { text-decoration: underline; }
.wq-card-link .ui-icon { width: 12px; height: 12px; }

/* Up next: the one fact a person in the field wants, large enough to read from arm's length. */
.wq-next { border-color: color-mix(in srgb, var(--brass), var(--border) 55%); }
.wq-next-when { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 600; color: var(--wq-brass-ink); line-height: 1.2; }
.wq-next-what { display: block; margin-top: 6px; font-size: 14px; }
.wq-next-who { font-size: 13px; }
.wq-next-where { margin-top: 2px; font-size: 12px; color: var(--muted); }
.wq-next-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.wq-alert-list { list-style: none; margin: 0 -8px; padding: 0; display: grid; gap: 1px; }
.wq-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 7px 8px; border-radius: 8px; color: var(--text); text-decoration: none; }
.wq-alert:hover { background: var(--surface-hover); }
.wq-alert:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wq-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--muted); }
.wq-dot.warning { background: var(--brass); }
.wq-dot.critical { background: var(--wq-late); }
.wq-alert-text { min-width: 0; display: grid; gap: 1px; }
.wq-alert-text b { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wq-alert-text small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Team: problem tiles, the watch line, and who has what ---- */
.wq-issues { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 12px; }
.wq-issue {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
    padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-panel);
    color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.wq-issue:hover { border-color: color-mix(in srgb, var(--wq-late), var(--border) 55%); }
.wq-issue:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wq-issue.active { border-color: var(--wq-late); background: color-mix(in srgb, var(--wq-late), var(--surface-panel) 92%); }
.wq-issue.is-empty { opacity: .55; }
.wq-issue-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--wq-late), transparent 88%); color: var(--wq-late-ink); }
.wq-issue-icon .ui-icon { width: 14px; height: 14px; }
.wq-issue-text { min-width: 0; display: grid; gap: 1px; }
.wq-issue-text b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wq-issue-text small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wq-issue-count { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 700; color: var(--wq-late-ink); font-variant-numeric: tabular-nums; }
.wq-issue.is-empty .wq-issue-count { color: var(--muted); }

.wq-watch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.wq-watch-label { margin-right: 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.wq-watch-chip {
    display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 4px 12px;
    border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font-size: 12px; cursor: pointer;
}
.wq-watch-chip .ui-icon { width: 13px; height: 13px; color: var(--chart-primary); }
.wq-watch-chip b { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.wq-watch-chip small { font-size: 11px; color: var(--muted); }
.wq-watch-chip:hover { border-color: color-mix(in srgb, var(--chart-primary), var(--border) 50%); }
.wq-watch-chip.active { border-color: var(--chart-primary); background: color-mix(in srgb, var(--chart-primary), transparent 88%); }

.wq-people-list { list-style: none; margin: 0 -8px; padding: 0; display: grid; gap: 1px; }
.wq-person {
    width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
    padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.wq-person:hover { background: var(--surface-hover); }
.wq-person:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wq-person.active { background: color-mix(in srgb, var(--brass), transparent 88%); box-shadow: inset 2px 0 0 var(--brass); }
.wq-person:disabled { cursor: default; }
.wq-person .wq-avatar { width: 28px; height: 28px; font-size: 10.5px; }
.wq-person-text { min-width: 0; display: grid; gap: 1px; }
.wq-person-text b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wq-person-text small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wq-person-figs { display: grid; justify-items: end; gap: 1px; }
.wq-person-items { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; color: var(--muted); }
.wq-person-items.bad { color: var(--wq-late-ink); }
.wq-person-figs small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* ---- Narrower screens ---- */
@media (max-width: 1180px) {
    .wq-hero { grid-template-columns: 1fr; align-items: start; }
    .wq-layout { grid-template-columns: 1fr; }
    .wq-aside { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
}

@media (max-width: 720px) {
    .wq-hello h2 { font-size: 18px; }
    .wq-lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wq-search { min-width: 0; flex: 1 1 100%; }
    /* The row folds to two lines: what and who on top, when and the action underneath. */
    .wq-item,
    .wq-list.is-team .wq-item {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        grid-template-areas: "kind text text" "kind when actions";
        row-gap: 6px;
    }
    .wq-list.is-team .wq-item { grid-template-areas: "kind text text" "kind owner owner" "kind when actions"; }
    .wq-when { text-align: left; }
}
