/* Contact-history modal for the Beekeeper Work Review roster.
   A vertical timeline of one beekeeper's contact log (the contacts JSON), opened
   from the Contact chip. Uses the _tokens.css variables so light + dark themes
   both render correctly (ad-hoc Tailwind dark: utilities no-op here). */

.ch-dialog {
    /* Center in the viewport top layer (some admin resets drop the UA centering). */
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(34rem, 92vw);
    max-height: 80vh;
    padding: 0;
    border: 1px solid var(--border-base);
    border-radius: 0.75rem;
    background: var(--surface-card);
    color: var(--text-body);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.ch-dialog::backdrop {
    background: var(--surface-overlay);
    backdrop-filter: blur(2px);
}

.ch-head {
    position: sticky;
    top: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-base);
    background: var(--surface-card);
}
.ch-title { font-size: 1rem; font-weight: 700; color: var(--text-strong); }
.ch-sub { margin-top: 2px; font-size: 0.75rem; color: var(--text-muted); }
.ch-close {
    padding: 2px;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-muted);
    line-height: 1;
    cursor: pointer;
}
.ch-close:hover { background: var(--surface-sunken); color: var(--text-body); }

.ch-body { padding: 1rem 1.25rem 1.25rem; overflow-y: auto; }

.ch-timeline { position: relative; margin: 0; padding: 0 0 0 1.25rem; list-style: none; }
/* the spine */
.ch-timeline::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-base);
}
.ch-item { position: relative; padding: 0 1.5rem 1.1rem 0.25rem; }
.ch-item:last-child { padding-bottom: 0; }

/* per-entry hard-delete control (top-right of the item, revealed on hover) */
.ch-del-form { position: absolute; top: 0; right: 0; }
.ch-del {
    display: inline-flex;
    padding: 2px;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-faint);
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.ch-del .material-symbols-outlined { font-size: 1rem; }
.ch-item:hover .ch-del,
.ch-del:focus-visible { opacity: 1; }
.ch-del:hover { background: var(--surface-sunken); color: #dc2626; }
/* the node: amber ring = awaiting reply, solid green = replied */
.ch-item::before {
    content: "";
    position: absolute;
    left: -1.25rem;
    top: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface-card);
    border: 2px solid #d97706;
}
.ch-item.is-replied::before { background: #16a34a; border-color: #16a34a; }

.ch-when { font-size: 0.8125rem; font-weight: 600; color: var(--text-strong); }
.ch-meta { margin-top: 1px; font-size: 0.6875rem; color: var(--text-muted); }
.ch-note { margin-top: 0.25rem; font-size: 0.8125rem; color: var(--text-body); white-space: pre-wrap; }
.ch-reply { margin-top: 2px; font-size: 0.6875rem; color: #15803d; }
.ch-empty { font-size: 0.8125rem; font-style: italic; color: var(--text-muted); }

/* the trigger chip behaves like a button */
.ch-trigger { cursor: pointer; border: none; background: transparent; padding: 0; }

/* add-contact form inside the history modal */
.ch-add {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-base);
}
.ch-add textarea { width: 100%; }

/* ── KPI info tooltips (top-of-roster stat tiles) ─────────────────── */
.kpi-info { position: relative; display: inline-flex; align-items: center; cursor: help; color: var(--text-faint); }
.kpi-info:hover,
.kpi-info:focus-visible { color: var(--text-body); outline: none; }
.kpi-tip {
    display: none;
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    width: 17rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-base);
    border-radius: 0.5rem;
    background: var(--surface-card);
    color: var(--text-body);
    font-size: 0.6875rem;
    line-height: 1.4;
    font-weight: 400;
    text-transform: none;
    white-space: normal;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.kpi-info:hover .kpi-tip,
.kpi-info:focus-within .kpi-tip { display: block; }

/* ── In-cell hover tooltip — shows the full user-submitted text ───── */
.cell-tip { position: relative; display: inline-block; max-width: 100%; cursor: help; }
.cell-tip-body {
    display: none;
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    width: 28rem;
    max-width: 90vw;
    max-height: 24rem;
    overflow: auto;
    white-space: pre-wrap;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-base);
    border-radius: 0.5rem;
    background: var(--surface-card);
    color: var(--text-body);
    font-size: 0.8rem;
    line-height: 1.45;
    font-weight: 400;
    text-transform: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.cell-tip:hover .cell-tip-body,
.cell-tip:focus-within .cell-tip-body { display: block; }
