/* ===========================================================================
   Queries page (Query Dashboard) — matched to the Carisma prototype.
   Green #0F7A4A, red #D9473F / #A31F15, blue #2F6BB0, amber #D9A13B, brand var(--primary-color).
   =========================================================================== */

.qry-page { display: flex; flex-direction: column; gap: 22px; }

/* -------------------------------- banner --------------------------------- */
.qry-banner {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
    background: linear-gradient(120deg, #f7ecef 0%, #faf3ee 55%, #f6f3fb 100%);
    border: 1px solid #f1e6e8; border-radius: 18px; padding: 12px 24px;
}
.qry-banner__tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.qry-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; font-size: .85rem; margin-bottom: 4px; color: #6b5f63; }
.qry-crumb a { color: #6b5f63; text-decoration: none; }
.qry-crumb a:hover { color: var(--primary-color); text-decoration: underline; }
.qry-crumb strong { color: #1c1416; font-weight: 700; }
.qry-crumb__sep { color: #cdbfc3; }
.qry-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: #1c1416; margin: 0 0 2px; }
.qry-sub { color: #6b5f63; font-size: .85rem; margin: 0; }

.qry-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.qry-h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; color: #1c1416; margin: 0 0 4px; }

/* ---------------------------- segmented control -------------------------- */
.qry-seg { display: inline-flex; flex-wrap: wrap; background: #f4f1f0; border-radius: 12px; padding: 4px; gap: 2px; }
.qry-seg__btn {
    display: inline-flex; align-items: center; gap: 8px; border: none; background: transparent; cursor: pointer;
    font-size: .9rem; font-weight: 600; color: #4b4145; padding: 9px 16px; border-radius: 9px; white-space: nowrap;
}
.qry-seg__btn:hover:not(:disabled):not(.is-active) { color: var(--primary-color); }
.qry-seg__btn:disabled { cursor: default; }
.qry-seg__btn.is-active { background: var(--primary-color); color: #fff; box-shadow: 0 2px 6px rgba(122, 31, 43, .3); }
.qry-seg__btn .material-symbols-rounded { font-size: 17px; }
.qry-seg__count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px;
    border-radius: 999px; font-size: .72rem; font-weight: 700; background: #fff; color: var(--primary-color);
}
.qry-seg__count--dark { background: var(--primary-color); color: #fff; }

/* buttons + chips */
.qry-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; cursor: pointer;
    border: 1px solid #ddd5d1; border-radius: 10px; background: #fff; color: var(--primary-color);
    font-size: .9rem; font-weight: 600;
}
.qry-btn:hover:not(:disabled) { background: #fbf4f6; border-color: var(--primary-color); }
.qry-btn:disabled { cursor: default; }
.qry-btn .material-symbols-rounded { font-size: 18px; }
.qry-btn--sm { height: 30px; padding: 0 12px; font-size: .78rem; }
.qry-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.qry-chip--brand { background: #f6e9ed; color: var(--primary-color); }

/* --------------------------------- card ---------------------------------- */
.qry-card {
    background: #fff; border: 1px solid #ece6e2; border-top: 3px solid #e9c7d2; border-radius: 18px;
    box-shadow: 0 1px 2px rgba(20, 20, 40, .04); overflow: hidden;
}
.qry-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid #f1ece9; }
.qry-card__title { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #1c1416; }
.qry-card__icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: #f6e9ed; color: var(--primary-color); }
.qry-card__note { font-size: .78rem; font-weight: 500; color: #6b5f63; }

/* ------------------------------ count cards ------------------------------ */
.qry-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; padding: 20px; border-bottom: 1px solid #f1ece9; }
.qry-bc {
    display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: 14px; background: #faf8f6;
    min-width: 0; border: 1px solid #f1ece9; box-shadow: inset 4px 0 0 var(--acc);
}
.qry-bc.is-on { border-color: var(--primary-color); box-shadow: inset 4px 0 0 var(--acc), inset 0 0 0 1px var(--primary-color); }
.qry-bc__top {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; width: 100%;
    border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: inherit;
}
.qry-bc__col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.qry-lbl { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #3d3236; }
.qry-bc__num { font-size: 2rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; color: #1c1416; font-variant-numeric: tabular-nums; }
.qry-bc__num.is-zero, .qry-leg__num.is-zero { color: #a99da1; }
.qry-unit { font-size: .78rem; color: #6b5f63; text-align: right; }
.qry-track { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: #f1ece9; }
.qry-track span { display: block; height: 100%; }
.qry-legend { display: flex; flex-wrap: wrap; gap: 4px; }
.qry-leg {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 10px; cursor: pointer;
    border: 1.5px solid transparent; background: transparent; font: inherit; font-size: .78rem; color: #3d3236;
}
.qry-leg.is-on { background: #fff; border-color: var(--primary-color); }
.qry-leg__dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.qry-leg__num { font-size: 1rem; font-weight: 700; color: #1c1416; }

.qry-pickbar { display: flex; align-items: center; gap: 10px; font-size: .82rem; font-weight: 600; padding: 12px 20px; border-bottom: 1px solid #f1ece9; }

/* --------------------------------- grid ---------------------------------- */
.qry-tablewrap { overflow-x: auto; }
.qry-table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: .88rem; }
.qry-table th {
    background: #f6ecef; color: #5a2636; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid #ece6e2;
}
.qry-sort {
    display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer;
    font: inherit; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #5a2636; white-space: nowrap;
}
.qry-sort .material-symbols-rounded { font-size: 15px; color: #b9a1a8; }
.qry-sort:hover, .qry-sort.is-sorted, .qry-sort.is-sorted .material-symbols-rounded { color: var(--primary-color); }
.qry-filter th { padding: 8px 8px 10px; }
.qry-filter input {
    width: 100%; min-width: 60px; box-sizing: border-box; padding: 8px 10px; border: 1px solid #ddd5d1; border-radius: 8px; background: #fff;
    font: inherit; font-size: .82rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: #1c1416;
}
.qry-filter th:first-child input { min-width: 160px; }
.qry-filter input:focus { outline: none; border-color: var(--primary-color); }
.qry-table td { padding: 12px 14px; border-bottom: 1px solid #f1ece9; vertical-align: middle; font-variant-numeric: tabular-nums; }
.qry-table tbody tr.qry-row { background: #fff; cursor: pointer; }
.qry-table tbody tr.qry-row:nth-child(odd) { background: #fcf8f9; }
.qry-table tbody tr.qry-row:hover { background: #f9eef2; }
.qry-table .qry-bl { border-left: 1px solid #ece6e2; }
.qry-c { text-align: center !important; }
.qry-row.is-mine .qry-jid { box-shadow: inset 3px 0 0 var(--primary-color); }
.qry-jid { white-space: nowrap; font-size: .82rem; font-weight: 700; letter-spacing: .02em; color: var(--primary-color); }
.qry-jname { font-weight: 600; min-width: 190px; color: #1c1416; }
.qry-strong { font-weight: 700; }
.qry-ok { color: #0d6a40; }
.qry-bad { font-weight: 700; color: #b42318; }
.qry-nil { color: #a99da1; }
.qry-held { font-size: .82rem; }
.qry-total td { background: #faf8f6; font-weight: 700; }
.qry-total .qry-ok { color: #0d6a40; }
.qry-total .qry-bad { color: #a31f15; }
.qry-go {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 16px;
    border: 1px solid #ddd5d1; background: #fff; color: var(--primary-color); cursor: pointer; padding: 0;
}
.qry-go .material-symbols-rounded { font-size: 20px; }
.qry-go:hover { background: #fbf4f6; border-color: var(--primary-color); }

.qry-jname a { color: inherit; text-decoration: none; }
.qry-jname a:hover { color: var(--primary-color); text-decoration: underline; }
.qry-btn--solid { background: var(--primary-color); border-color: var(--primary-color); color: #fff; height: 40px; }
.qry-btn--solid:hover:not(:disabled) { background: #6a1229; border-color: #6a1229; }
.qry-btn--solid:disabled { opacity: .5; }
.qry-btn--dark-text { color: #1c1416; text-decoration: none; }
.qry-btn--sm.qry-btn--solid { height: 34px; }
.qry-empty { align-items: center; text-align: center; padding: 40px 20px; display: flex; flex-direction: column; gap: 10px; color: #6b5f63; }
.qry-empty .material-symbols-rounded { font-size: 36px; color: #cdbfc3; }

/* ------------------------------- job header ------------------------------ */
.qry-job { background: #fff; border: 1px solid #ece6e2; border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.qry-job__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.qry-job__code { font-size: .75rem; letter-spacing: .02em; color: var(--primary-color); font-variant-numeric: tabular-nums; }
.qry-job__name { font-size: 1.25rem; font-weight: 700; color: #1c1416; }
.qry-job__client { text-decoration: underline; text-decoration-color: #d4a3b2; text-underline-offset: 4px; }
.qry-job__meta { font-size: .82rem; color: #6b5f63; }
.qry-job__right { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: flex-end; }
.qry-job__people { display: flex; flex-direction: column; font-size: .82rem; line-height: 1.5; color: #6b5f63; text-align: right; padding-right: 20px; border-right: 1px solid #ece6e2; }
.qry-job__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qry-job__actions .qry-btn { height: 40px; padding: 0 16px; font-size: .85rem; }
.qry-btn--blue { background: #1a4f91; border-color: #1a4f91; color: #fff; height: 40px; }
.qry-btn--blue:hover:not(:disabled) { background: #153f74; border-color: #153f74; }

.qry-stepper { display: flex; flex-wrap: wrap; gap: 4px; }
.qry-step { flex: 1 1 130px; min-width: 0; padding: 6px 8px; border-radius: 6px; font-size: .78rem; font-weight: 600; text-align: center; line-height: 1.35; }
.qry-step--current { color: #fff; }
.qry-step--done { background: #e3f3ea; color: #0d6a40; }
.qry-step--todo { background: #f7f5f3; color: #5e5357; }
.qry-step__actor { font-weight: 400; font-size: .7rem; opacity: .9; }

/* ------------------------------ Raise Query ------------------------------ */
.qry-modal { position: fixed; inset: 0; z-index: 1055; background: rgba(28, 20, 22, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; }
.qry-modal__box { width: 100%; max-width: 860px; background: #fff; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.qry-modal__head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.qry-modal__titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qry-modal__title { font-size: 1.15rem; font-weight: 700; color: #1c1416; }
.qry-modal__sub { font-size: .82rem; color: #6b5f63; }
.qry-field { display: flex; flex-direction: column; gap: 8px; }
.qry-field__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qry-field__label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #6b5f63; }
.qry-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qry-pill {
    height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid #ddd5d1; background: #fff; cursor: pointer;
    font-size: .85rem; font-weight: 600; color: #1c1416; box-shadow: 0 1px 0 #f1e6e8;
}
.qry-pill:hover { border-color: var(--primary-color); }
.qry-pill.is-on { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.qry-search { margin-left: auto; height: 34px; width: 220px; max-width: 100%; border: 1px solid #ddd5d1; border-radius: 10px; padding: 0 10px; font-size: .82rem; }
.qry-ledgers { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 240px; overflow-y: auto; padding: 2px; }
.qry-ledger {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; text-align: left; cursor: pointer;
    border: 1px solid transparent; border-radius: 10px; background: transparent; font-size: .82rem; font-weight: 600; color: #1c1416;
}
.qry-ledger:hover { background: #fcf8f9; }
.qry-ledger.is-on { background: #f6e9ed; border-color: var(--primary-color); }
.qry-note { font-size: .82rem; color: #6b5f63; }
.qry-note--err { color: #a31f15; }
.qry-link { border: 0; background: none; padding: 0; color: var(--primary-color); font-weight: 600; text-decoration: underline; cursor: pointer; }
.qry-newledger { height: 32px; padding: 0 12px; border-radius: 10px; border: 1px dashed var(--primary-color); background: #fff; color: var(--primary-color); font-size: .82rem; font-weight: 600; cursor: pointer; }
.qry-addledger { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: #faf8f6; border: 1px solid #ece6e2; border-radius: 10px; padding: 8px 10px; }
.qry-addledger__label { font-size: .75rem; font-weight: 600; color: #3d3236; }
.qry-addledger__input { flex: 1 1 220px; min-width: 0; height: 34px; border: 1px solid #ddd5d1; border-radius: 6px; padding: 0 10px; font-size: .82rem; }
.qry-addledger__hint { flex-basis: 100%; font-size: .7rem; color: #9a8d92; }
.qry-note--ok { color: #0d6a40; }
.qry-addledger__err { flex-basis: 100%; font-size: .78rem; color: #a31f15; }

/* ------------------------- Raise Query: 3. Query ------------------------- */
.qry-field--step { border-top: 1px solid #f1ece9; padding-top: 12px; }
.qry-q__ledger { font-size: .9rem; font-weight: 700; color: #1c1416; }
.qry-mode { margin-left: auto; display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: #f7f5f3; border: 1px solid #ece6e2; }
.qry-mode__btn { height: 32px; padding: 0 14px; border-radius: 6px; border: 0; background: transparent; color: #5e5357; font-size: .82rem; font-weight: 600; cursor: pointer; }
.qry-mode__btn:disabled { opacity: .55; cursor: default; }
.qry-mode__btn.is-on { background: var(--primary-color); color: #fff; }
.qry-search--wide { margin-left: 0; width: 100%; }
.qry-tpls { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; padding: 2px; }
.qry-tpl { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; text-align: left; border: 1px solid #ece6e2; border-radius: 10px; background: #fff; }
.qry-tpl__meta { font-size: .72rem; color: #9a8d92; }
.qry-tpl__q { white-space: pre-line; font-size: .85rem; color: #1c1416; line-height: 1.4; }
.qry-tpl__a { white-space: pre-line; font-size: .8rem; color: #0d6a40; line-height: 1.4; }
.qry-tpl__a b { font-weight: 700; }
.qry-typerow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.qry-typerow__end { margin-left: auto; }
.qry-sources { display: flex; gap: 6px; }
.qry-source { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid #ddd5d1; background: #fff; color: #3d3236; font-size: .82rem; font-weight: 600; cursor: pointer; }
.qry-source:hover { border-color: var(--primary-color); }
.qry-source--cli.is-on { background: #1a4f91; border-color: #1a4f91; color: #fff; }
.qry-source--int.is-on { background: #8a5200; border-color: #8a5200; color: #fff; }
.qry-types { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: #f7f5f3; border: 1px solid #ece6e2; }
.qry-type { height: 34px; padding: 0 14px; border-radius: 8px; border: 0; background: transparent; color: #5e5357; font-size: .82rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.qry-type:hover:not(.is-on) { color: var(--primary-color); }
.qry-type.is-on { background: var(--primary-color); color: #fff; }
.qry-textarea { width: 100%; border: 1px solid #ddd5d1; border-radius: 10px; padding: 10px 12px; resize: vertical; font: inherit; font-size: .9rem; }
.qry-textarea:focus { outline: none; border-color: var(--primary-color); }
.qry-q__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.qry-q__foot .qry-note { flex: 1 1 260px; }
.qry-btn--lg { height: 42px; padding: 0 18px; font-size: .9rem; }
.qry-qc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .78rem; }
.qry-qc__score { font-weight: 700; color: #3d3236; margin-right: 2px; }
.qry-qc__chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 12px; cursor: default; }
.qry-qc__chip.is-ok { background: #e3f3ea; color: #0d6a40; }
.qry-qc__chip.is-warn { background: #fcf0dc; color: #8a5200; }
.qry-qc__tidy { margin-left: auto; }
.qry-toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: #e3f3ea; color: #0d6a40; font-size: .88rem; font-weight: 600; }
.qry-toast .material-symbols-rounded { font-size: 20px; }
.qry-toast__x { margin-left: auto; border: 0; background: none; color: inherit; cursor: pointer; display: inline-flex; padding: 0; }
.qry-emptyrow { text-align: center; color: #6b5f63; padding: 24px !important; }

/* ------------------------ job page: query list, card view ------------------------ */
.qry-tabs { display: flex; gap: 4px; border-bottom: 1px solid #ece6e2; }
.qry-tab { border: 0; background: none; padding: 10px 14px; font-size: .9rem; font-weight: 600; color: #5e5357; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.qry-tab.is-on { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.qry-downloadrow { display: flex; justify-content: flex-end; margin-top: 12px; }
.qry-pickbar--bare { padding: 0; border: 0; }

.qry-group { display: flex; flex-direction: column; gap: 10px; }
.qry-group__head { display: flex; align-items: center; gap: 10px; }
.qry-group__name { font-size: 1rem; font-weight: 700; color: #1c1416; }
.qry-group__count { font-size: .78rem; color: #6b5f63; }
.qry-group__rule { flex: 1; height: 1px; background: #ece6e2; }

.qry-q { background: #fff; border: 1px solid #ece6e2; border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.qry-q__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qry-q__ledger-name { font-size: .9rem; font-weight: 600; color: #1c1416; text-decoration: underline; text-decoration-color: #d4a3b2; text-underline-offset: 4px; }
.qry-q__ref { font-size: .78rem; letter-spacing: .02em; color: var(--primary-color); font-variant-numeric: tabular-nums; }
.qry-q__text { margin: 0; font-size: .92rem; line-height: 1.55; color: #1c1416; }

.qry-tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.qry-tag--cli { background: #e6eef9; color: #1a4f91; }
.qry-tag--int { background: #fcf0dc; color: #8a5200; }
.qry-tag--type { background: #f1ece9; color: #4a3f43; }


.qry-loop { border-top: 1px solid #f1ece9; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.qry-loop__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qry-loop__label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #6b5f63; }
.qry-loop__round { font-size: .78rem; color: #6b5f63; }

/* ------------------------------ chat thread (Carisma view) ------------------------------
   Our (Carisma) messages on the right, the client's on the left, like WhatsApp / Teams. */
/* extra bottom margin: the last row's tools hang below the bubble (absolutely positioned, so it doesn't
   grow this container's own box) and would otherwise sit under the composer below it */
.qry-chat { display: flex; flex-direction: column; gap: 28px; padding: 16px; margin-bottom: 14px; border-radius: 16px; background: linear-gradient(180deg, #faf7f5 0%, #f6f1ee 100%); }
.qry-chatrow { display: flex; align-items: flex-end; gap: 8px; }
.qry-chatrow--ours { flex-direction: row-reverse; }
.qry-avatar { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .66rem; font-weight: 700; letter-spacing: .02em; color: #fff; }
.qry-avatar .material-symbols-rounded { font-size: 18px; }
.qry-avatar--ours { background: linear-gradient(135deg, #9b2347, var(--primary-color)); }
.qry-avatar--theirs { background: linear-gradient(135deg, #4b7bb8, #1a4f91); }

.qry-msg { position: relative; max-width: 88%; padding: 10px 14px 8px; border-radius: 18px; box-shadow: 0 1px 2px rgba(28, 20, 22, .06); }
.qry-msg--theirs { background: #fff; border: 1px solid #ebe5e1; border-bottom-left-radius: 6px; }
.qry-msg--ours { background: #f7e9ee; border: 1px solid #efd3dc; border-bottom-right-radius: 6px; }
.qry-msg--editing { width: 88%; }
.qry-msg__meta { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; font-size: .72rem; margin-bottom: 3px; }
.qry-msg__from { font-weight: 700; color: #1c1416; }
.qry-msg__at { color: #7b6f73; white-space: nowrap; }
.qry-msg__text { font-size: .9rem; line-height: 1.55; color: #1c1416; white-space: pre-wrap; overflow-wrap: anywhere; }
.qry-msg__file { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 4px 10px; border-radius: 999px; background: #eef3fa; font-size: .78rem; font-weight: 600; color: #1a4f91; }
.qry-msg__file .material-symbols-rounded { font-size: 16px; }

/* review state under our own messages */
.qry-msg__review { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 9px 2px 6px; border-radius: 999px; font-size: .7rem; font-weight: 700; }
.qry-msg__review .material-symbols-rounded { font-size: 14px; }
.qry-msg--ours .qry-msg__review { float: right; }
.qry-msg__foot .qry-msg__review { float: none; margin-top: 0; }
.qry-msg__review--pending { background: #fcf0dc; color: #8a5200; }
.qry-msg__review--approved { background: #e3f3ea; color: #0d6a40; }
.qry-msg__review--rejected { background: #fbe7e5; color: #a31f15; }
.qry-msg__review--endclient { background: #e6eef9; color: #1a4f91; }
.qry-msg::after { content: ""; display: block; clear: both; }

/* tools on our own messages, alongside the review badge */
.qry-msg__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.qry-msg__tools { display: inline-flex; gap: 2px; margin-left: -4px; }
.qry-tool { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 9px; background: none; color: #6b5f63; cursor: pointer; padding: 0; transition: background .15s, color .15s; }
.qry-tool:hover { background: #f4eef0; color: var(--primary-color); }
.qry-tool--del:hover { background: #fbe7e5; color: #a31f15; }
.qry-tool--endclient:hover { background: #e6eef9; color: #1a4f91; }
.qry-tool .material-symbols-rounded { font-size: 19px; }

/* editing a message: roomy box with labelled buttons */
.qry-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.qry-edit__input { width: 100%; min-height: 96px; padding: 10px 12px; border: 1px solid #e2cfd6; border-radius: 12px; background: #fff; resize: vertical; font: inherit; font-size: .9rem; line-height: 1.5; outline: none; }
.qry-edit__input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(122, 31, 43, .12); }
.qry-edit__foot { display: flex; justify-content: flex-end; gap: 8px; }
.qry-pillbtn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 16px; border-radius: 999px; border: 1px solid #ddd5d1; background: #fff; color: #3d3236; font-size: .82rem; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.qry-pillbtn:hover:not(:disabled) { background: #f7f5f3; border-color: #cdbfc3; }
.qry-pillbtn--primary { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.qry-pillbtn--primary:hover:not(:disabled) { background: #6a1229; border-color: #6a1229; }
.qry-pillbtn--danger { background: #c0392b; border-color: #c0392b; color: #fff; }
.qry-pillbtn--danger:hover:not(:disabled) { background: #a5301f; border-color: #a5301f; }
.qry-pillbtn:disabled { opacity: .5; cursor: default; }

/* message box: always available under the thread */
.qry-wa { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; padding: 6px 6px 6px 8px; background: #fff; border: 1px solid #e6dfdb; border-radius: 28px; box-shadow: 0 2px 10px rgba(28, 20, 22, .06); transition: border-color .15s, box-shadow .15s; }
.qry-wa:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(122, 31, 43, .12); }
.qry-wa__input { flex: 1; min-width: 0; min-height: 28px; max-height: 140px; border: 0; outline: none; resize: none; field-sizing: content; padding: 10px 0; font: inherit; font-size: .92rem; line-height: 1.4; background: transparent; }
.qry-wa__send { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: linear-gradient(135deg, #9b2347, var(--primary-color)); color: #fff; cursor: pointer; padding: 0; box-shadow: 0 4px 10px rgba(122, 31, 43, .35); transition: transform .12s, box-shadow .12s; }
.qry-wa__send:hover:not(:disabled) { transform: translateY(-1px) scale(1.04); box-shadow: 0 6px 14px rgba(122, 31, 43, .42); }
.qry-wa__send:disabled { background: #e3d9dc; box-shadow: none; cursor: default; }
.qry-wa__send .material-symbols-rounded { font-size: 22px; font-variation-settings: 'FILL' 1; }

/* remove confirmation */
.qry-confirm { width: 100%; max-width: 420px; margin-top: 12vh; background: #fff; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.qry-confirm__icon { align-self: flex-start; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #fbe7e5; color: #a31f15; }
.qry-confirm__icon--info { background: #e6eef9; color: #1a4f91; }
.qry-confirm__title { font-size: 1.1rem; font-weight: 700; color: #1c1416; }
.qry-confirm__body { font-size: .88rem; color: #6b5f63; line-height: 1.5; }
.qry-confirm__quote { padding: 8px 12px; border-left: 3px solid #e2cfd6; border-radius: 4px; background: #faf7f5; font-size: .85rem; color: #3d3236; max-height: 90px; overflow: hidden; }
.qry-confirm__foot { display: flex; justify-content: flex-end; gap: 8px; }

/* edit-query modal (EditQueryModal) */
.qry-editmodal { width: 100%; max-width: 560px; margin-top: 8vh; background: #fff; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.qry-editmodal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.qry-editmodal__titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qry-editmodal__title { font-size: 1.1rem; font-weight: 700; color: #1c1416; }
.qry-editmodal__sub { font-size: .82rem; color: #6b5f63; }
.qry-editmodal__body { display: flex; flex-direction: column; gap: 8px; }
.qry-editmodal__label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #6b5f63; }
.qry-editmodal__body .qry-linkfield { margin-top: 6px; }
.qry-editmodal__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid #f1ece9; }
.qry-editmodal__note { font-size: .78rem; color: #6b5f63; flex: 1 1 220px; }
.qry-editmodal__footbtns { display: flex; gap: 8px; }

/* import-historical-queries modal (ImportHistoricalQueriesModal) */
.qry-importmodal { max-width: 780px; }
.imp-count { margin-left: 8px; font-size: .78rem; font-weight: 500; color: #6b5f63; }
.imp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.imp-col { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: #f9f6f5; border: 1px solid #f1ece9; border-radius: 12px; }
.imp-col__title { margin: 0; font-size: .92rem; font-weight: 700; color: #1c1416; }
.imp-col__text { margin: 0; font-size: .82rem; color: #6b5f63; line-height: 1.45; }
.imp-filerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imp-filebtn { position: relative; overflow: hidden; }
.imp-filebtn__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.imp-filerow__name { font-size: .82rem; color: #6b5f63; }
.imp-filebtn.is-disabled { opacity: .5; pointer-events: none; }
.imp-msg { margin: 0; font-size: .82rem; color: #1c1416; }
.imp-msg--error { color: #c0392b; }
.imp-resultswrap { margin-top: 6px; max-height: 280px; overflow: auto; border: 1px solid #eceae8; border-radius: 10px; }
.imp-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.imp-table th { position: sticky; top: 0; z-index: 1; background: #f9f6f5; text-align: left; padding: 8px 10px; font-weight: 700; color: #6b5f63; border-bottom: 1px solid #eceae8; white-space: nowrap; }
.imp-table td { padding: 7px 10px; border-bottom: 1px solid #f3efed; color: #2b2f36; vertical-align: top; }
.imp-table__query { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-row--bad { background: #fdf3f2; }
.imp-status--ok { color: #0f7a4a; font-weight: 600; white-space: nowrap; }
.imp-status--bad { color: #c0392b; font-weight: 600; }

/* email-queries modal (EmailQueriesModal) */
.qry-emailmodal { max-width: 640px; }
.qry-emailmodal__body { min-height: 320px; font-family: ui-monospace, Consolas, Menlo, monospace; font-size: .82rem; }
.qry-emailfields { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: #f9f6f5; border: 1px solid #f1ece9; border-radius: 10px; margin-bottom: 4px; }
.qry-emailfields__row { display: flex; align-items: baseline; gap: 10px; }
.qry-emailfields__row .qry-editmodal__label { flex: 0 0 60px; }
.qry-emailfields__val { font-size: .85rem; color: #1c1416; word-break: break-word; }

@media (max-width: 640px) { .qry-msg { max-width: 88%; } .qry-msg--editing { width: 88%; } }

/* attachment link (links only, no files) */
.qry-msg__link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 4px 12px 4px 8px; border-radius: 999px; background: #e6eef9; color: #1a4f91; font-size: .78rem; font-weight: 700; text-decoration: none; transition: background .15s; }
.qry-msg__link:hover { background: #d3e2f6; text-decoration: underline; }
.qry-msg__link .material-symbols-rounded { font-size: 16px; }

.qry-composer { display: flex; flex-direction: column; gap: 6px; }
.qry-linkfield { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 12px; height: 40px; background: #fff; border: 1px solid #e2cfd6; border-radius: 12px; color: #6b5f63; }
.qry-linkfield:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(122, 31, 43, .12); }
.qry-linkfield.is-ok { border-color: #0f7a4a; color: #0f7a4a; }
.qry-linkfield.is-bad { border-color: #c0392b; color: #c0392b; }
.qry-linkfield--bar { border-radius: 999px; padding-left: 16px; }
.qry-linkfield .material-symbols-rounded { font-size: 20px; }
.qry-linkfield__input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font: inherit; font-size: .88rem; color: #1c1416; }
.qry-linkerr { padding: 0 14px; font-size: .75rem; color: #c0392b; }
/* small round icon buttons (add link, clear the link field) */
.qry-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #6b5f63; cursor: pointer; padding: 0; transition: background .15s, color .15s; }
.qry-icon:hover:not(:disabled) { background: #f4eef0; color: var(--primary-color); }
.qry-icon:disabled { opacity: .4; cursor: default; }
.qry-icon .material-symbols-rounded { font-size: 20px; }
.qry-icon--clear { color: #b9aab0; }
.qry-icon--clear .material-symbols-rounded { font-size: 22px; font-variation-settings: 'FILL' 1; }
.qry-icon--clear:hover:not(:disabled) { background: transparent; color: #a31f15; }
.qry-preview-note { padding: 0 14px; font-size: .72rem; color: #9a8d92; }
.qry-linkerr--flush { padding: 0; }

/* reviewer: approve / edit / remove under a message waiting for review */
.qry-review { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e2cfd6; }
.qry-pillbtn--approve { background: #0f7a4a; border-color: #0f7a4a; color: #fff; height: 30px; padding: 0 14px; }
.qry-pillbtn--approve:hover:not(:disabled) { background: #0b6339; border-color: #0b6339; }
.qry-pillbtn .material-symbols-rounded { font-size: 18px; }
.qry-pillbtn--edit { background: #fff; border-color: #1a4f91; color: #1a4f91; height: 30px; padding: 0 14px; }
.qry-pillbtn--edit:hover:not(:disabled) { background: #eef3fa; }
.qry-pillbtn--remove { background: #fff; border-color: #c0392b; color: #c0392b; height: 30px; padding: 0 14px; }
.qry-pillbtn--remove:hover:not(:disabled) { background: #fdf3f2; }

/* "Attach link" button in the message box: a labelled pill so it is obvious what it does (links only, no files) */
.qry-linkbtn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px 0 10px; border: 1px solid #ecd9df; border-radius: 999px; background: #fbf4f6; color: var(--primary-color); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.qry-linkbtn:hover:not(:disabled) { background: #f6e9ed; border-color: #e2c3cd; }
.qry-linkbtn.is-on { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.qry-linkbtn:disabled { opacity: .45; cursor: default; }
.qry-linkbtn .material-symbols-rounded { font-size: 19px; }
@media (max-width: 520px) { .qry-linkbtn__text { display: none; } .qry-linkbtn { padding: 0 10px; } }

/* status 4: the message has been moved to the end client */
.qry-msg__moved { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 7px; border-top: 1px dashed #e2cfd6; font-size: .74rem; font-weight: 700; color: #1a4f91; }
.qry-msg__moved .material-symbols-rounded { font-size: 17px; }

/* edit form: Query with / Query type / Question */
.qry-edit__group { display: flex; flex-direction: column; gap: 6px; }
.qry-edit__label { font-size: .78rem; font-weight: 600; color: #3d3236; }

/* a saved link that is not a full http(s) address: plain, not clickable */
.qry-msg__link--plain { background: #f1ece9; color: #4a3f43; cursor: default; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qry-msg__link--plain:hover { background: #f1ece9; text-decoration: none; }

/* "Query resolved" note under the accepted message, and the button that resolves the query */
.qry-msg__resolved { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 7px; border-top: 1px dashed #bfe0cd; font-size: .78rem; font-weight: 700; color: #0d6a40; }
.qry-msg__resolved .material-symbols-rounded { font-size: 18px; font-variation-settings: 'FILL' 1; }
.qry-resolve { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e2e7ec; }
.qry-pillbtn--wide { padding: 0 16px 0 12px; }

/* dashboard grid: view switch + search, jobs without queries, Raise query button */
.qry-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 20px; border-bottom: 1px solid #f1ece9; }
.qry-toolbar .qry-search { margin-left: auto; }
.qry-row--empty td, .qry-row--empty .qry-ok { color: #a99da1; }
.qry-row--empty .qry-jname a { color: #3d3236; }
.qry-actcell { text-align: right; white-space: nowrap; }
.qry-raisebtn { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px 0 8px; border: 1px solid var(--primary-color); border-radius: 999px; background: #fff; color: var(--primary-color); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.qry-raisebtn:hover { background: var(--primary-color); color: #fff; }
.qry-raisebtn .material-symbols-rounded { font-size: 18px; }

/* ---- Query Knowledge Base (design; sample data) ---- */
.kb-import {
    height: 44px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer; white-space: nowrap;
    background: #1f4f9a; color: #fff; font: inherit; font-size: .95rem; font-weight: 700; box-shadow: 0 2px 6px rgba(31, 79, 154, .3);
}
.kb-import:hover { filter: brightness(1.1); }
.kb-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; }

.kb-clients { background: #fff; border: 1px solid #eceae8; border-radius: 16px; padding: 18px 12px; position: sticky; top: 12px; }
.kb-clients__head { padding: 0 10px 10px; font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b5f63; }
.kb-clients__list { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto; }
.kb-client {
    display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 0; border-radius: 10px; cursor: pointer;
    background: transparent; text-align: left; font: inherit;
}
.kb-client:hover { background: #faf3f5; }
.kb-client__name { font-weight: 700; color: #1c1416; font-size: .98rem; }
.kb-client__sub { color: #6b5f63; font-size: .84rem; }
.kb-client.is-active { background: var(--primary-color); }
.kb-client.is-active .kb-client__name, .kb-client.is-active .kb-client__sub { color: #fff; }

.kb-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.kb-card { background: #fff; border: 1px solid #eceae8; border-radius: 16px; padding: 20px 24px 22px; }
.kb-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kb-name { margin: 0; font-size: 1.45rem; font-weight: 800; color: #1c1416; }
.kb-meta { color: #6b5f63; font-size: .9rem; margin-top: 2px; }
.kb-h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1.1rem; font-weight: 700; color: #1c1416; }

.kb-jobs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; font-size: .86rem; color: #5b6270; }
.kb-job { padding: 6px 12px; border: 1px solid #e3d8db; border-radius: 999px; color: var(--primary-color); font-weight: 600; background: #fff; }

.kb-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; }
.kb-fact__l { font-size: .84rem; color: #6b5f63; margin-bottom: 2px; }
.kb-fact__v { font-size: .94rem; color: #1c1416; line-height: 1.45; }

.kb-qs { display: flex; flex-direction: column; gap: 10px; }
.kb-q { border: 1px solid #eef0f3; border-left: 3px solid #e9c7d2; border-radius: 0 12px 12px 0; padding: 12px 14px; background: #fcfbfa; }
.kb-q__top { display: flex; gap: 8px; margin-bottom: 6px; }
.kb-q__fy { padding: 2px 9px; border-radius: 999px; background: #f6e9ed; color: var(--primary-color); font-size: .74rem; font-weight: 700; }
.kb-q__area { padding: 2px 9px; border-radius: 999px; background: #f1edeb; color: #3d3236; font-size: .74rem; font-weight: 600; }
.kb-q__ask, .kb-q__ans { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; line-height: 1.45; }
.kb-q__ask { color: #1c1416; font-weight: 600; }
.kb-q__ans { color: #3d3236; margin-top: 6px; }
.kb-q__ask .material-symbols-rounded { font-size: 18px; color: var(--primary-color); flex: none; margin-top: 1px; }
.kb-q__ans .material-symbols-rounded { font-size: 18px; color: #0f7a4a; flex: none; margin-top: 1px; }
.kb-empty { padding: 22px; text-align: center; color: #6b5f63; border: 1px dashed #e3d8db; border-radius: 12px; font-size: .9rem; }

.kb-toast {
    position: fixed; right: 24px; bottom: 24px; z-index: 3500; pointer-events: none; max-width: 420px;
    background: #1c1416; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: .9rem; animation: kb-toast 4s ease forwards;
}
@keyframes kb-toast { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 1200px) { .kb-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kb-layout { grid-template-columns: 1fr; } .kb-clients { position: static; } }
@media (max-width: 560px) { .kb-facts { grid-template-columns: 1fr; } }

/* ---- Pending review (messages waiting for the reviewer) ---- */
.qry-pending { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 8px; border-radius: 999px; background: #fdf0d5; color: #8a5200; font-size: .7rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.qry-awaiting { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 20px 0; padding: 10px 14px; border-radius: 12px; background: #fdf0d5; border: 1px solid #f0d9a0; color: #5c3a00; font-size: .88rem; }
.qry-awaiting .material-symbols-rounded { font-size: 22px; color: #8a5200; }
.qry-awaiting__text { flex: 1 1 260px; }
.qry-awaiting__jobs { flex: 1 1 100%; order: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: .84rem; }
.qry-awaiting__job { color: #7a1f3d; font-weight: 600; text-decoration: underline; }

/* ---- Query Knowledge Base: tiles, tabs, filters, query cards ---- */
.kb-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kb-kpi { background: #fff; border: 1px solid #eceae8; border-radius: 14px; padding: 14px 14px 12px; }
.kb-kpi__l { font-size: .72rem; font-weight: 700; letter-spacing: .05em; color: #5b6270; }
.kb-kpi__v { font-size: 1.6rem; font-weight: 800; color: #1c1416; line-height: 1.2; margin: 2px 0 4px; }
.kb-kpi__link { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: .82rem; color: var(--primary-color); }
.kb-kpi__link:hover { text-decoration: underline; }

.kb-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e6e2e0; flex-wrap: wrap; }
.kb-tab { border: 1px solid transparent; border-bottom: 0; background: none; padding: 10px 12px; cursor: pointer; font: inherit; font-size: .92rem; color: #3d3236; border-radius: 6px 6px 0 0; }
.kb-tab:hover { color: var(--primary-color); }
.kb-tab.is-active { border-color: var(--primary-color); border-bottom: 2px solid #fff; margin-bottom: -1px; color: #1c1416; font-weight: 600; background: #fff; }

.kb-filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kb-fy { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-pill { height: 32px; padding: 0 13px; border: 1px solid #ddd8d6; border-radius: 999px; background: #fff; cursor: pointer; font: inherit; font-size: .84rem; font-weight: 600; color: #1c1416; }
.kb-pill:hover { border-color: var(--primary-color); }
.kb-pill.is-active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.kb-search { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: #5b6270; }
.kb-search input { height: 34px; width: 220px; padding: 0 10px; border: 1px solid #d9dde3; border-radius: 8px; font: inherit; font-size: .88rem; outline: none; }
.kb-search input:focus { border-color: var(--primary-color); }

.kb-year { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.kb-year__fy { font-weight: 800; color: #1c1416; }
.kb-year__note { font-size: .8rem; color: #6b5f63; }

.kb-qc { background: #fff; border: 1px solid #eceae8; border-radius: 14px; padding: 14px 16px; }
.kb-qc__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kb-qc__id { font-size: .82rem; color: var(--primary-color); margin-right: 2px; }
.kb-tag { padding: 2px 8px; border-radius: 6px; background: #f1edeb; color: #3d3236; font-size: .76rem; }
.kb-tag--gold { background: #fdf0d5; color: #7a4f00; }
.kb-tag--green { background: #e3f3ea; color: #0d6a40; }
.kb-qc__title { margin: 8px 0; font-size: .98rem; font-weight: 700; color: #1c1416; }
.kb-qc__ans { padding: 10px 12px; border-radius: 8px; background: #f6f6f7; font-size: .88rem; color: #3d3236; line-height: 1.45; }
.kb-qc__ans b { color: #1c1416; }
.kb-qc__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 10px; font-size: .8rem; color: #6b5f63; }
.kb-qc__open { margin-left: auto; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: .82rem; color: var(--primary-color); text-decoration: underline; }

@media (max-width: 560px) { .kb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kb-search input { width: 100%; } }

/* ---- Query Knowledge Base: live data ---- */
.kb-clients__search { width: calc(100% - 20px); margin: 0 10px 10px; height: 34px; padding: 0 10px; border: 1px solid #d9dde3; border-radius: 8px; font: inherit; font-size: .88rem; outline: none; box-sizing: border-box; }
.kb-clients__search:focus { border-color: var(--primary-color); }
.kb-qc__q { margin: 8px 0; font-size: .92rem; color: #1c1416; line-height: 1.5; white-space: pre-line; }
.kb-qc__ans { white-space: pre-line; }
.kb-qc__act { margin-top: 6px; padding: 8px 12px; border-radius: 8px; background: #f3f8f5; font-size: .86rem; color: #3d3236; line-height: 1.45; white-space: pre-line; }
.kb-qc__act b { color: #0d6a40; }
.kb-qc__job { margin-left: auto; color: #8a8f99; }
.kb-more { align-self: center; height: 38px; padding: 0 18px; border: 1px solid #d9dde3; border-radius: 10px; background: #fff; cursor: pointer; font: inherit; font-weight: 600; color: var(--primary-color); }
.kb-more:hover { border-color: var(--primary-color); }
.kb-jobs .kb-job { cursor: default; }
.kb-kpi__note { font-size: .82rem; color: #5b6270; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
