/* ============================================================================
   Organization triggers (KBW-0348): the /triggers page, its scope filter in the
   left panel, and the sentence editor in the right dock. Theme variables only
   (theme.css); the filter mirrors the Resources tree so the two read alike.
   ============================================================================ */

/* ── Left panel: scope filter ─────────────────────────────────────────────── */
.trg-panel { display: flex; flex-direction: column; gap: 1px; padding: .35rem .5rem .5rem; }

.trg-node {
    display: flex; align-items: center; gap: .55rem; width: 100%;
    padding: .42rem .55rem; border: 0; border-radius: 9px;
    background: transparent; color: var(--ink);
    font-size: .855rem; line-height: 1.2; text-align: left; cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.trg-node:hover { background: var(--we); }
.trg-node.on    { background: var(--human-soft); color: var(--human-text); font-weight: 600; }
.trg-node.sub   { padding-left: .9rem; }
.trg-node-lbl   { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trg-node-n     { font-size: .75rem; color: var(--ink-soft); }
.trg-node.on .trg-node-n { color: inherit; }

.trg-ico {
    flex: 0 0 auto; width: 16px; height: 16px;
    fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
    opacity: .75;
}
.trg-node.on .trg-ico { opacity: 1; }

.trg-group-head {
    font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-soft); padding: .9rem .55rem .3rem;
}
.trg-group-empty { font-size: .8rem; color: var(--ink-soft); padding: 0 .55rem; margin: 0; }

/* Plan cap: how many are active, and red once the plan holds fewer than are on. */
.trg-cap {
    margin-top: 1rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px;
    display: flex; flex-direction: column; gap: .4rem;
}
.trg-cap-row { display: flex; justify-content: space-between; font-size: .75rem; color: var(--ink-soft); }
.trg-cap-n   { font-weight: 600; color: var(--human-text); }
.trg-cap-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.trg-cap-bar > div { height: 100%; background: var(--human); }
.trg-cap.over .trg-cap-n { color: var(--alert-text); }
.trg-cap.over .trg-cap-bar > div { background: var(--alert); }

/* ── List ─────────────────────────────────────────────────────────────────── */
.trg-list { display: flex; flex-direction: column; gap: .6rem; }

.trg-card {
    display: flex; align-items: center; gap: 1rem;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: .9rem 1.1rem; cursor: pointer;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.trg-card:hover { border-color: var(--human); }
.trg-card.sel   { border-color: var(--human); box-shadow: var(--shadow); }
.trg-card.off .trg-card-main { opacity: .6; }

.trg-card-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.trg-card-name { font-weight: 600; font-size: .95rem; color: var(--ink); }
.trg-card-rule { font-size: .85rem; color: var(--ink-soft); }
.trg-card-error { font-size: .78rem; color: var(--alert-text); }
.trg-card-when { flex: 0 0 auto; font-size: .75rem; color: var(--ink-soft); min-width: 7rem; text-align: right; }

.trg-scope {
    flex: 0 0 auto; padding: .2rem .65rem; border-radius: 999px;
    background: var(--paper); color: var(--ink-soft); font-size: .75rem; white-space: nowrap;
}
.trg-scope.proj { background: var(--focus-soft); color: var(--focus-text); }

.trg-empty { padding: 2rem 0; display: flex; flex-direction: column; align-items: flex-start; gap: .8rem; color: var(--ink-soft); }

/* ── Editor (right dock) ──────────────────────────────────────────────────── */
.trg-editor { display: flex; flex-direction: column; gap: .55rem; padding: 1rem 1.1rem 1.2rem; }
.trg-ed-title { margin: 0 0 .4rem; font-family: var(--font-head); font-size: 1.15rem; }
.trg-label { font-size: .75rem; font-weight: 600; color: var(--ink-soft); margin-top: .4rem; }

.trg-scope-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* Templates: one press fills the rule. */
.trg-templates { display: flex; flex-wrap: wrap; gap: .4rem; }
.trg-tpl {
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    border-radius: 999px; padding: .35rem .75rem; font-size: .8rem; cursor: pointer;
}
.trg-tpl:hover { border-color: var(--human); }
.trg-tpl.on    { background: var(--human-soft); border-color: var(--human); color: var(--human-text); font-weight: 600; }
.trg-tpl-desc  { margin: .2rem 0 0; font-size: .8rem; color: var(--ink-soft); }

/* A value a template left for the person to choose. */
.trg-blank { border-color: var(--amber) !important; background: var(--amber-soft) !important; }
.trg-proj-btn  { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The only scope this person manages: stated, not offered. */
.trg-scope-fixed { font-size: .875rem; font-weight: 600; color: var(--ink); }

.trg-block { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: .5rem; }
.trg-block-head {
    display: flex; justify-content: space-between; padding: .4rem .8rem; background: var(--paper);
    font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: var(--ink-soft);
}
.trg-optional { font-weight: 500; letter-spacing: 0; text-transform: none; }
.trg-block-body { padding: .75rem .8rem; display: flex; flex-direction: column; gap: .6rem; }

.trg-row { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.trg-row .k-field { width: auto; max-width: 100%; }
.trg-num { width: 5rem !important; }

.trg-action { display: flex; flex-direction: column; gap: .45rem; }
.trg-sub    { padding-left: 1.9rem; }
.trg-sub .k-field { width: 100%; }
.trg-step {
    flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border-radius: 50%;
    background: var(--paper); color: var(--ink-soft); font-size: .72rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.trg-person { font-weight: 600; margin-right: .6rem; }

.trg-add, .trg-remove { border: none; background: none; cursor: pointer; padding: .2rem 0; }
.trg-add    { align-self: flex-start; color: var(--human-text); font-size: .8rem; font-weight: 600; }
.trg-remove { color: var(--ink-soft); font-size: 1.1rem; width: 2rem; height: 2rem; border-radius: 8px; }
.trg-remove:hover { background: var(--we); color: var(--ink); }

/* "In words": the whole rule re-read in plain language before saving. */
.trg-words {
    margin-top: .6rem; padding: .8rem .9rem; border-radius: 12px;
    background: var(--human-soft); color: var(--human-text); line-height: 1.5; font-size: .88rem;
}
.trg-words-head { font-size: .68rem; font-weight: 700; letter-spacing: .08em; margin-bottom: .25rem; }

.trg-ed-foot { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; }
.trg-enabled { flex: 1 1 auto; }

@media (max-width: 768px) {
    .trg-card { flex-wrap: wrap; }
    .trg-card-when { min-width: 0; text-align: left; }
    .trg-sub { padding-left: 0; }
}

/* Organization setting: may project managers switch the org rules off (KBT-0005). */
.trg-override { margin: 0 0 1rem; }
.trg-override-hint { display: block; font-size: .8rem; color: var(--ink-soft); }
.trg-card-excluded { font-size: .8rem; color: var(--ink-soft); }
.trg-section { font-size: .95rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
.trg-section-note { margin: 0 0 .5rem; font-size: .85rem; }
