/*
 * XK Grid — Bootstrap/Volt theme layer
 *
 * LIVE copy (public_html/assets/theme.css) of frontend_template/assets/style.css; the template
 * file is the static reference mirror, this one is what the app loads (keep both in sync). Load order on every page:
 *   assets/vendor/bootstrap/bootstrap.min.css -> assets/vendor/fontawesome/css/all.min.css
 *   -> assets/theme.css -> style.css (the few legacy global rules still needed; last so they win ties).
 * Re-points Bootstrap 5.3's CSS custom-property theme (the --bs-* variables) at XK-Grid's existing
 * dark palette so every Bootstrap component inherits the app's look. The .xk-* classes cover what
 * Bootstrap has no equivalent for (sidebar nav, task-topbar, badges per color-map.md, dashboard cards).
 * Breakpoint: sidebar is fixed at >=992px (`lg`), a Bootstrap off-canvas drawer below it.
 * See docs/frontend_layout.md.
 */

:root,
[data-bs-theme="dark"] {
    --bs-body-bg: #0f172a;
    --bs-body-color: #f1f5f9;
    --bs-emphasis-color: #f8fafc;
    --bs-secondary-color: #94a3b8;
    --bs-tertiary-color: #64748b;
    --bs-border-color: #334155;
    --bs-border-color-translucent: #334155;

    --bs-secondary-bg: #1e293b;
    --bs-tertiary-bg: #0f172a;

    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
    --bs-link-color: #38bdf8;
    --bs-link-color-rgb: 56, 189, 248;
    --bs-link-hover-color: #7dd3fc;
    --bs-link-hover-color-rgb: 125, 211, 252;

    --bs-card-bg: var(--bs-secondary-bg);
    --bs-card-border-color: var(--bs-border-color);
    --bs-card-border-radius: .875rem;
    --bs-card-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .25), 0 1px 2px 0 rgba(0, 0, 0, .15);

    --bs-offcanvas-bg: #1e293b;
    --bs-offcanvas-color: #f1f5f9;
    --bs-offcanvas-border-color: #334155;
    --bs-offcanvas-box-shadow: 0 25px 60px rgba(0, 0, 0, .45);

    --bs-focus-ring-color: rgba(59, 130, 246, .35);
    --bs-code-color: #7dd3fc;   /* Bootstrap's default <code> pink is not in the palette */

    color-scheme: dark;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Generic visibility utility — mirrors public_html/style.css (`.hidden`).
   Production page JS shows/hides elements by toggling this class (133
   classList.add/remove/toggle('hidden') sites in public_html/*.js), and that
   JS is kept as-is (issue decision), so every element whose visibility JS
   toggles MUST use `hidden`, never Bootstrap's `d-none`: both are
   `display:none !important`, but JS only knows about `hidden`, so a `d-none`
   element can never be shown by `classList.remove('hidden')`. `d-none` stays
   only for purely static hiding (e.g. the Quill-backing <textarea>s).
   See docs/frontend_layout.md ("Known gotchas"). */
.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bs-tertiary-bg); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: var(--bs-border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }
html { scrollbar-width: thin; scrollbar-color: #334155 #0f172a; }

/* ── Forms — match the app's existing dark input treatment ────────────── */

.form-control,
.form-select {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}
.form-control:focus,
.form-select:focus {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .2);
}
.form-control::placeholder { color: #475569; }
/* style.css's global `input { padding: .65rem .875rem }` (legacy pages) would stretch Bootstrap checkboxes */
.form-check-input { padding: 0; }
.form-label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* ── Buttons ────────────────────────────────────────────────────────────
   Bootstrap's .btn-primary already themes off --bs-primary; .xk-btn-gradient
   reproduces the login/submit gradient the app already uses. */

.xk-btn-gradient {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border: none;
    color: #fff;
    font-weight: 600;
}
.xk-btn-gradient:hover,
.xk-btn-gradient:focus { color: #fff; opacity: .9; }
.xk-btn-gradient:active { transform: scale(.99); }

/* Secondary outline buttons (Edit, Cancel, Summary, ...): the legacy ghost-button look — slate text and border,
   light text on hover. Bootstrap's stock gray (#6c757d) is hard to read on the dark cards. */
.btn-outline-secondary {
    --bs-btn-color: #94a3b8;
    --bs-btn-border-color: #334155;
    --bs-btn-hover-color: #f1f5f9;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: #94a3b8;
    --bs-btn-active-color: #f1f5f9;
    --bs-btn-active-bg: #1e293b;
    --bs-btn-active-border-color: #94a3b8;
    --bs-btn-disabled-color: #94a3b8;
    --bs-btn-disabled-border-color: #334155;
}

/* ── Login (standalone shell) ──────────────────────────────────────────── */

.xk-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.xk-login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    padding: 2.75rem 2.5rem 2.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .45);
}
.xk-login-logo {
    display: block;
    height: 36px;
    margin: 0 auto 2.5rem;
}

/* ── Sidebar + main shell ──────────────────────────────────────────────── */

.xk-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}
.xk-main-col {
    min-width: 0; /* prevents the flex item from forcing horizontal overflow */
}

/* Below 992px (`lg`): plain Bootstrap `.offcanvas` behavior — hidden until
   toggled via data-bs-toggle="offcanvas", with backdrop, focus-trap,
   Esc-to-close and body-scroll-lock all handled by Bootstrap's JS.
   At >=992px: pinned open as a static 260px column. Bootstrap ships an
   `.offcanvas-lg` class for this, but its CSS only takes effect nested
   inside a `.navbar.navbar-expand-lg` wrapper, so the equivalent rules are
   reproduced here directly against `.xk-sidebar` instead. */
.xk-sidebar.offcanvas {
    width: 260px;
}
.xk-sidebar .offcanvas-header {
    border-bottom: 1px solid var(--bs-border-color);
}
.xk-sidebar-brand {
    height: 28px;
}
@media (min-width: 992px) {
    .xk-sidebar.offcanvas {
        position: sticky;      /* stays in view while the page scrolls, so the footer (heartbeat/profile/sign-out) is always reachable */
        top: 0;
        align-self: flex-start;
        height: 100vh;
        z-index: auto;
        visibility: visible !important;
        transform: none !important;
        max-width: none;
        flex-shrink: 0;
        box-shadow: none;
    }
    .xk-sidebar .offcanvas-body { display: flex; overflow: hidden; min-height: 0; }
}

.xk-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 1rem .75rem;
    flex: 1;
    min-height: 0;   /* lets the nav scroll inside the sidebar while the footer stays pinned */
    overflow-y: auto;
}
.xk-nav-section-label {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--bs-tertiary-color);
    padding: 1rem .75rem .25rem;
}
.xk-nav-section-label:first-child { padding-top: .25rem; }
.xk-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: .5rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.xk-nav-link:hover { background: var(--bs-border-color); color: var(--bs-body-color); }
.xk-nav-link.active { background: var(--bs-tertiary-bg); color: #38bdf8; }

.xk-inbox-badge {
    background: #3b82f6; /* color-map.md: reassigned off red, more saturated than TODO's blue */
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1;
    padding: .25em .5em;
    border-radius: 10rem;
}

.xk-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1rem .75rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: .8125rem;
}
.xk-heartbeat-btn,
.xk-logout-btn {
    background: none;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    border-radius: .5rem;
    padding: .35rem .6rem;
    font-size: .8rem;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.xk-heartbeat-btn:hover,
.xk-logout-btn:hover { border-color: #3b82f6; color: #7dd3fc; } /* neutral blue — sign-out is not a destructive action, so no red (color-map.md) */
.xk-heartbeat-btn:disabled { opacity: .5; cursor: default; } /* sidebar.js disables it (indicator only; it fires on a timer) */
.xk-heartbeat-btn:disabled:hover { border-color: var(--bs-border-color); color: var(--bs-secondary-color); }

.xk-profile-btn {
    background: none;
    border: none;
    color: inherit;
    padding: .35rem .5rem;
    border-radius: .5rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    transition: background .15s;
}
.xk-profile-btn:hover { background: var(--bs-border-color); }
.xk-profile-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.xk-profile-hint {
    font-size: .7rem;
    color: var(--bs-tertiary-color);
    transition: color .15s;
}
.xk-profile-btn:hover .xk-profile-hint { color: var(--bs-secondary-color); }

/* Sidebar toggle button — visible only below the lg breakpoint, where the
   sidebar becomes an offcanvas drawer instead of a fixed column. */
.xk-sidebar-toggle {
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    border-radius: .5rem;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.xk-sidebar-toggle:hover { border-color: #3b82f6; color: #7dd3fc; }

.xk-topbar-mobile {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1rem;
    background: var(--bs-card-bg);
    border-bottom: 1px solid var(--bs-border-color);
}
@media (max-width: 991.98px) {
    .xk-topbar-mobile { display: flex; }
}

.xk-main {
    flex: 1;
    min-width: 0;
    padding: 2rem;
}
@media (max-width: 575.98px) {
    .xk-main { padding: 1.25rem; }
}

/* ── Task-topbar shell (no sidebar; task.php / routine.html) ──────────── */

.xk-task-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bs-card-bg);
    border-bottom: 1px solid var(--bs-border-color);
    flex-wrap: wrap;
}
.xk-task-topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.xk-btn-back {
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
}
.xk-btn-back:hover { color: var(--bs-body-color); }
/* .xk-task-content (the centered detail column) is defined once, below, in the
   detail/tabs section — 900px max-width, matching production's chat/compose/
   transition columns. */

/* ── Badges (color-map.md) ─────────────────────────────────────────────
   One .xk-badge--<concept> class per color-map.md row. Solid background +
   matching bright text, consistent with the existing badge treatment. */

.xk-badge {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: calc(.3em - 1px) calc(.65em - 1px);   /* minus the 1px border, so bordered and plain badges are the same size */
    border: 1px solid transparent;
    border-radius: 10rem;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;   /* badges keep their shape; a long neighbouring name wraps instead */
    flex-shrink: 0;
}
.xk-badge--outline { background: transparent; border: 1px solid currentColor; }

.xk-badge--project   { color: #7dd3fc; background: #1e2d40; border-color: #1e4060; }  /* border: the fill is nearly the card color */
.xk-badge--goal       { color: #6ee7b7; background: #052e16; }
.xk-badge--agent      { color: #c4b5fd; background: #3b1f5f; }
.xk-badge--tool       { color: #67e8f9; background: #1e3a4a; }
.xk-badge--node       { color: #2dd4bf; background: #0f2e2b; }
.xk-badge--alert      { color: #a5b4fc; background: #312e81; }
.xk-badge--role-admin { color: #a5b4fc; background: #312e81; }
.xk-badge--role-user  { color: #94a3b8; background: #1e293b; border-color: #334155; }

/* Each state class has two selectors that resolve to the SAME rule: the
   semantic name used in the static templates (-todo, -exec, -attention, ...)
   and the RAW state value (-TODO, -IN_EXECUTION, -ON_HOLD, ...). Production
   JS builds badge classes from the raw value (`badge--state-${task.state}`,
   ~25 sites), so wiring is a class-PREFIX swap only
   (`badge badge--state-${state}` -> `xk-badge xk-badge--state-${state}`) with
   no state->class mapping function. Class selectors are case-sensitive, so
   the raw-value aliases must stay upper-case exactly as the API returns them.
   See docs/frontend_layout.md ("State-badge aliases"). */
.xk-badge--state-attention,
.xk-badge--state-ON_HOLD     { color: #78350f; background: #fbbf24; }
.xk-badge--state-blocked,
.xk-badge--state-BLOCKED     { color: #7c2d12; background: #fb923c; }
.xk-badge--state-failed,
.xk-badge--state-FAILED      { color: #fff; background: #ef4444; } /* reserved: failed executions only */
.xk-badge--state-todo,
.xk-badge--state-TODO        { color: #082f49; background: #38bdf8; }
.xk-badge--state-exec,
.xk-badge--state-IN_EXECUTION { color: #2e1065; background: #a78bfa; }
.xk-badge--state-done,
.xk-badge--state-DONE        { color: #052e16; background: #4ade80; }
.xk-badge--state-cancelled,
.xk-badge--state-CANCELLED   { color: #1e293b; background: #94a3b8; }

.xk-badge--priority-1 { color: #64748b; background: transparent; border: 1px solid #334155; }   /* color-map.md: 1 = gray, 2 = light gray (both outlined) */
.xk-badge--priority-2 { color: #94a3b8; background: transparent; border: 1px solid #475569; }
.xk-badge--priority-3 { color: #082f49; background: #60a5fa; }
.xk-badge--priority-4 { color: #fff; background: #7c3aed; }
.xk-badge--priority-5 { color: #fff; background: #5b21b6; }

/* ── Detail/tabs content pattern (task.php / routine.html) ─────────────
   Ports public_html/style.css's task-detail/chat-timeline rules onto the
   Bootstrap/Volt theme layer, under an .xk- prefix so Phase 6's wiring pass
   can tell "new" classes apart from the old ones being replaced. Colors are
   largely unchanged — the app's existing dark palette and this theme layer's
   --bs-* re-point already match, so most of this reuses the same hex values
   verified in the original, plus color-map.md's badge classes above. */

.xk-task-content {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}
@media (max-width: 575.98px) {
    .xk-task-content { padding: 1.25rem; }
}

.xk-parent-crumb { margin-bottom: 1rem; min-width: 0; }
.xk-parent-link {
    min-width: 0;
    overflow-wrap: anywhere;   /* long unbroken names (URLs, file names) wrap instead of widening the page */
    font-size: .8375rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
    transition: color .15s;
}
.xk-parent-link:hover { color: #38bdf8; }

.xk-task-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.xk-task-detail-title-block { min-width: 0; flex: 1 1 auto; }
.xk-task-title-state-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.xk-task-detail-name {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
    margin: 0;
}
.xk-task-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    flex-shrink: 0;
}
/* Detail pages inside the sidebar shell: <main class="xk-main"> already provides the padding */
.xk-main > .xk-task-content { padding: 0; }
@media (max-width: 575.98px) {
    .xk-task-detail-name { font-size: 1.25rem; }
}

.xk-task-detail-desc {
    color: var(--bs-secondary-color);
    font-size: .9375rem;
    line-height: 1.7;
    margin-bottom: 1.75rem;
    white-space: pre-wrap; /* plain-text descriptions (agents/inbox) keep their line breaks, as before */
    word-break: break-word;
}
.xk-no-desc { color: var(--bs-tertiary-color); font-style: italic; }
.xk-task-detail-desc code {
    background: var(--bs-tertiary-bg);
    color: #7dd3fc;
    border-radius: 4px;
    padding: .1em .3em;
}

.xk-task-relations {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 1.25rem;
    margin-bottom: 1.5rem;
}
.xk-relations-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-tertiary-color);
    margin-bottom: .6rem;
}
.xk-relations-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.xk-relation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
    padding: .6rem .875rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, background .15s;
}
.xk-relation-row:hover { border-color: #475569; background: #162032; }
.xk-relation-row--static { cursor: default; }
.xk-relation-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: .9rem;
    color: var(--bs-body-color);
    text-decoration: none;
}
a.xk-relation-name:hover { color: #38bdf8; }

.xk-task-transitions {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 1.5rem;
}
.xk-transition-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .6rem;
}
@media (max-width: 575.98px) {
    /* Wrapping left "Cancelled" orphaned alone on its own row — pin all 4
       buttons to one row instead, shrinking padding/font-size to fit. */
    .xk-transition-buttons-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: .35rem;
    }
    .xk-btn-transition {
        padding: .4rem .2rem;
        font-size: .7rem;
        text-align: center;
    }
}
.xk-btn-transition {
    border: none;
    border-radius: .5rem;
    padding: .45rem .9rem;
    font-size: .8375rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.xk-btn-transition:hover { opacity: .8; }
.xk-btn-transition--IN_EXECUTION { background: #1e3a5f; color: #38bdf8; }
.xk-btn-transition--ON_HOLD      { background: #3a2e0f; color: #fbbf24; }
.xk-btn-transition--BLOCKED      { background: #3a1f0f; color: #fb923c; }
.xk-btn-transition--DONE         { background: #1f3a2a; color: #4ade80; }
.xk-btn-transition--CANCELLED    { background: #2a1f1f; color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); }
.xk-no-transitions { font-size: .875rem; color: var(--bs-tertiary-color); }

/* ── Execution history (chat-style timeline) ─────────────────────────── */

.xk-exec-timeline {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    margin-bottom: 1.25rem;
}
.xk-exec-empty {
    font-size: .875rem;
    color: var(--bs-tertiary-color);
    text-align: center;
    padding: 1.25rem 0;
    margin: 0;
}

.xk-chat-row { display: flex; align-items: flex-start; gap: .6rem; }
.xk-chat-row--left  { align-self: flex-start; max-width: 82%; }
.xk-chat-row--right { align-self: flex-end; max-width: 82%; }
.xk-chat-row--tool  { align-self: stretch; }
.xk-chat-row--milestone { align-self: center; min-width: 0; max-width: 100%; }
.xk-chat-row--state-change { align-self: flex-start; align-items: center; min-width: 0; max-width: 100%; }
@media (max-width: 575.98px) {
    .xk-chat-row--left, .xk-chat-row--right { max-width: 92%; }
}

.xk-chat-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: .2rem;
}
.xk-chat-avatar--user   { background: #3730a3; color: #a5b4fc; }
.xk-chat-avatar--system { background: #0c4a6e; color: #38bdf8; font-size: .85rem; }

.xk-chat-bubble {
    border-radius: .75rem;
    padding: .6rem .875rem;
    word-break: break-word;
    min-width: 0;
}
.xk-chat-bubble--user   { background: #1e2d50; border: 1px solid #2d3f6b; }
.xk-chat-bubble--system { background: #162032; border: 1px solid var(--bs-border-color); }
.xk-chat-bubble--queued { border-style: dashed; }

.xk-chat-meta {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .3rem;
    flex-wrap: wrap;
}
.xk-chat-meta--right { flex-direction: row-reverse; }
.xk-chat-author { font-size: .75rem; font-weight: 600; color: var(--bs-secondary-color); }
.xk-chat-dt { font-size: .7rem; color: var(--bs-tertiary-color); }
.xk-chat-content { margin: 0; font-size: .875rem; color: #e2e8f0; word-break: break-word; line-height: 1.55; }
.xk-chat-content a { color: #38bdf8; text-decoration: underline; }

.xk-chat-state-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bs-tertiary-color);
    flex-shrink: 0;
    margin: 0 .3rem;
}
.xk-chat-state-arrow { font-size: .7rem; color: var(--bs-tertiary-color); }
.xk-chat-state-by { font-size: .72rem; padding: .1rem .4rem; border-radius: .25rem; }
.xk-chat-state-by--user   { background: #1e2a40; color: #7dd3fc; }
.xk-chat-state-by--system { background: #1a2410; color: #86efac; }
.xk-chat-milestone-body {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    min-width: 0;   /* lets the badges/date wrap inside the row on phones instead of dropping below the dot */
}
.xk-chat-milestone-link {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: .875rem;
    color: var(--bs-body-color);
    text-decoration: none;
}
.xk-chat-milestone-link:hover { color: #38bdf8; }
.xk-chat-milestone-label { font-size: .8rem; color: var(--bs-secondary-color); font-weight: 500; }
.xk-chat-milestone-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1f3a2a;
    color: #4ade80;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Tool execution card */
.xk-chat-tool-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #064e3b;
    color: #34d399;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    flex-shrink: 0;
    margin-top: .35rem;
}
.xk-chat-tool-icon--failed { background: #4c0519; color: #fca5a5; }
.xk-chat-tool-card {
    flex: 1;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .625rem;
    overflow: hidden;
    min-width: 0;
}
.xk-chat-tool-card--failed { border-color: #7f1d1d; }
.xk-chat-tool-card--failed .xk-chat-tool-name { color: #fca5a5; }
.xk-chat-tool-header {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    padding: .55rem .875rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: background .12s;
}
.xk-chat-tool-header:hover { background: #162032; }
.xk-chat-tool-header[aria-expanded="true"] .xk-tool-chevron { transform: rotate(90deg); }
.xk-chat-tool-name {
    font-size: .875rem;
    font-weight: 600;
    color: #e2e8f0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.xk-chat-tool-internal { font-size: .75rem; color: var(--bs-tertiary-color); flex-shrink: 0; }
@media (max-width: 575.98px) {
    /* Phones: the tool name gets the first line (with the chevron); internal name + time wrap below it,
       otherwise the name is squeezed to "Crea…" by the time and internal-name labels. */
    .xk-chat-tool-header { flex-wrap: wrap; row-gap: .1rem; }
    .xk-chat-tool-name { order: 1; flex: 1 1 calc(100% - 1.6rem); }
    .xk-tool-chevron { order: 2; }
    .xk-chat-tool-internal { order: 3; }
    .xk-chat-tool-header .xk-chat-dt { order: 4; }
}
.xk-tool-chevron { font-size: .7rem; color: var(--bs-tertiary-color); flex-shrink: 0; transition: transform .15s; }
.xk-chat-tool-body {
    border-top: 1px solid var(--bs-border-color);
    padding: .75rem .875rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.xk-tool-field { display: flex; flex-direction: column; gap: .3rem; }
.xk-tool-field-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--bs-tertiary-color);
}
.xk-tool-field-value {
    margin: 0;
    font-size: .79rem;
    background: #162032;
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    padding: .45rem .65rem;
    color: var(--bs-secondary-color);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'SFMono-Regular', Consolas, monospace;
}
.xk-tool-sources {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .79rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.xk-tool-sources li { overflow-wrap: anywhere; color: var(--bs-secondary-color); }
.xk-tool-open-btn {
    align-self: flex-start;
    background: none;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    border-radius: .3125rem;
    padding: .2rem .55rem;
    font-size: .75rem;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.xk-tool-open-btn:hover { border-color: #64748b; color: var(--bs-body-color); }

/* ── Comment compose ──────────────────────────────────────────────────── */

.xk-comment-compose {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 1rem;
    margin-top: .5rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.xk-comment-compose-row {
    display: grid;
    grid-template-columns: 1fr 44px;
    gap: .5rem;
    align-items: end;
}
@media (max-width: 575.98px) {
    .xk-comment-compose-row { grid-template-columns: 1fr; }
    .xk-btn-send { width: 100%; height: 38px; }
}
.xk-comment-queue-hint { color: var(--bs-tertiary-color); font-size: .8rem; margin: 0; }
.xk-btn-send {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border: none;
    border-radius: .5rem;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .15s;
}
.xk-btn-send:hover   { opacity: .85; }
.xk-btn-send:disabled { opacity: .4; cursor: not-allowed; }

/* ── Dependency picker (edit modal) ──────────────────────────────────── */

.xk-dep-modal-list {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .5rem;
}
.xk-dep-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    gap: .4rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10rem;
    padding: .25rem .4rem .25rem .7rem;
    font-size: .8rem;
    color: var(--bs-body-color);
}
.xk-dep-chip-remove {
    background: none;
    border: none;
    color: var(--bs-tertiary-color);
    cursor: pointer;
    padding: 0 .2rem;
    line-height: 1;
}
.xk-dep-chip-remove:hover { color: #ef4444; }
.xk-dep-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xk-dep-drop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    width: 100%;
    padding: .5rem .75rem;
    background: none;
    border: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .12s;
}
.xk-dep-drop-item:hover { background: var(--bs-tertiary-bg); }
.xk-dep-drop-name { min-width: 0; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xk-dep-search-wrap { position: relative; }
.xk-dep-dropdown {
    position: absolute;
    top: calc(100% + .25rem);
    left: 0;
    right: 0;
    z-index: 5;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    max-height: 220px;
    overflow-y: auto;
}

/* ── Routine detail page (routine.html) ──────────────────────────────── */

.xk-task-detail-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.xk-routine-meta {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
}
.xk-routine-meta-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; }
.xk-routine-meta-label { font-size: .8rem; color: var(--bs-tertiary-color); min-width: 120px; flex-shrink: 0; }
.xk-routine-meta-value { font-size: .9rem; color: #cbd5e1; word-break: break-word; }
code.xk-routine-meta-value {
    font-family: 'Courier New', monospace;
    background: var(--bs-secondary-bg);
    padding: .15rem .4rem;
    border-radius: 4px;
    font-size: .85rem;
}
.xk-task-detail-meta-footer {
    display: flex;
    gap: .25rem 2rem;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--bs-tertiary-color);
    border-top: 1px solid var(--bs-border-color);
    padding-top: 1.25rem;
}
/* Task-type badges (color-map.md "Task type"): agent = the Agent purple; human and monitoring no longer
   borrow the Project blue / Goal green, so they get their own slate / pink. */
.xk-badge--type-human      { color: #cbd5e1; background: #334155; }
.xk-badge--type-agent      { color: #c4b5fd; background: #3b1f5f; }
.xk-badge--type-monitoring { color: #f9a8d4; background: #3f1d38; }
/* Neutral chips: sub-task flag, knowledge-base keywords (not domain concepts) */
.xk-badge--neutral { color: #94a3b8; background: #1e293b; border: 1px solid #334155; }

/* ── Content-viewer modal (shared popup for tool input/output) ──────────
   Selectors are the exact ones public_html/content-viewer.js already
   queries (content-viewer.php's real ids/classes — not .xk-*, since the JS
   is loaded as-is per the issue's "JS unchanged, only selectors/CSS change"
   decision). Ported from public_html/style.css onto this theme layer's
   --bs-* tokens, same porting approach as the rest of this file. */

.content-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1060; /* above Bootstrap's .modal-backdrop (1050) and .modal (1055) if both are ever open */
    padding: 1rem;
}
.content-viewer.hidden { display: none !important; }

.content-viewer-card {
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .625rem;
    padding: 0;
    max-width: 740px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-viewer-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0 .5rem;
    flex-shrink: 0;
}

.content-viewer-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--bs-tertiary-color);
    cursor: pointer;
    font-size: .85rem;
    padding: .55rem .9rem .65rem;
    margin-bottom: -1px;
    transition: color .15s;
    white-space: nowrap;
}
.content-viewer-tab:hover { color: var(--bs-body-color); }
.content-viewer-tab.active { border-bottom-color: var(--bs-primary); color: var(--bs-body-color); font-weight: 600; }

.content-viewer-title {
    flex: 1;
    font-size: .78rem;
    color: var(--bs-tertiary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 .5rem;
}

.content-viewer-close {
    background: none;
    border: none;
    color: var(--bs-tertiary-color);
    font-size: 1.25rem;
    cursor: pointer;
    padding: .2rem .3rem;
    line-height: 1;
    flex-shrink: 0;
    margin-left: auto;
}
.content-viewer-close:hover { color: var(--bs-body-color); }

.content-viewer-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 1rem 1.25rem;
}

.content-viewer-pre {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: .82rem;
    color: var(--bs-body-color);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    line-height: 1.6;
}

.content-viewer-styled {
    color: var(--bs-body-color);
    font-size: .9rem;
    line-height: 1.65;
}
.content-viewer-styled ul,
.content-viewer-styled ol { padding-left: 1.5em; }
.content-viewer-styled li { margin-top: .25em; }
.content-viewer-styled a  { color: #38bdf8; }
.content-viewer-styled code {
    background: var(--bs-tertiary-bg);
    padding: .1em .4em;
    border-radius: 4px;
    font-family: 'SFMono-Regular', monospace;
    font-size: .85em;
}
.content-viewer-styled pre {
    background: var(--bs-tertiary-bg);
    padding: .75rem 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: .82rem;
    line-height: 1.5;
    margin: .5rem 0;
}
.content-viewer-styled table {
    border-collapse: collapse;
    width: 100%;
    font-size: .85rem;
}
.content-viewer-styled th,
.content-viewer-styled td { border: 1px solid var(--bs-border-color); padding: .3rem .7rem; }

.content-viewer-footer {
    display: flex;
    justify-content: flex-end;
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

/* ── Quill rich editor — Volt/Bootstrap dark theme ───────────────────────
   Ports public_html/style.css's Quill overrides (same visual result, same
   ql-* selectors — Quill's own DOM/classes don't change) onto the --bs-*
   tokens from this theme layer instead of hardcoded hex, so the editor
   tracks the rest of the page's palette. See docs/frontend_layout.md
   ("Quill re-theming" and the Phase 6 Quill gotchas). */

.rich-editor-wrap .ql-toolbar.ql-snow {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-bottom: none;
    border-radius: .5rem .5rem 0 0;
    padding: .4rem .5rem;
}
.rich-editor-wrap .ql-container.ql-snow {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0 0 .5rem .5rem;
    font-family: inherit;
    font-size: .9rem;
}
.rich-editor-wrap .ql-editor {
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    color: var(--bs-body-color);
    padding: .65rem .875rem;
    line-height: 1.6;
}
.rich-editor-wrap .ql-editor.ql-blank::before {
    color: #475569;
    font-style: normal;
    left: .875rem;
}
.rich-editor-wrap .ql-snow .ql-stroke { stroke: var(--bs-secondary-color); transition: stroke .15s; }
.rich-editor-wrap .ql-snow .ql-fill,
.rich-editor-wrap .ql-snow .ql-stroke.ql-fill { fill: var(--bs-secondary-color); transition: fill .15s; }
.rich-editor-wrap .ql-snow button:hover .ql-stroke,
.rich-editor-wrap .ql-snow button.ql-active .ql-stroke,
.rich-editor-wrap .ql-snow .ql-picker-label:hover .ql-stroke,
.rich-editor-wrap .ql-snow .ql-picker-label.ql-active .ql-stroke { stroke: var(--bs-body-color); }
.rich-editor-wrap .ql-snow button:hover .ql-fill,
.rich-editor-wrap .ql-snow button.ql-active .ql-fill { fill: var(--bs-body-color); }
.rich-editor-wrap .ql-toolbar.ql-snow .ql-picker-label { color: var(--bs-secondary-color); border-color: transparent; }
.rich-editor-wrap .ql-toolbar.ql-snow .ql-picker-label:hover,
.rich-editor-wrap .ql-toolbar.ql-snow .ql-picker-label.ql-active { color: var(--bs-body-color); }
.rich-editor-wrap .ql-snow .ql-picker-options {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.rich-editor-wrap .ql-snow .ql-picker-item { color: var(--bs-secondary-color); }
.rich-editor-wrap .ql-snow .ql-picker-item:hover,
.rich-editor-wrap .ql-snow .ql-picker-item.ql-selected { color: var(--bs-body-color); }
.rich-editor-wrap .ql-editor code,
.rich-editor-wrap .ql-editor pre { background: var(--bs-secondary-bg); color: #7dd3fc; border-radius: 4px; }
.rich-editor-wrap .ql-editor blockquote { border-left: 3px solid var(--bs-border-color); color: var(--bs-secondary-color); }
.rich-editor-wrap .ql-editor a { color: #38bdf8; }
/* The "Enter link" tooltip is white in Quill's stock snow theme */
.rich-editor-wrap .ql-snow .ql-tooltip {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    color: var(--bs-secondary-color);
}
.rich-editor-wrap .ql-snow .ql-tooltip input[type=text] {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    color: var(--bs-body-color);
}
.rich-editor-wrap .ql-snow .ql-tooltip a { color: #38bdf8; }

/* Comment-compose variant: smaller, borrows the sidebar's focus-ring blue
   instead of Quill's default focus treatment (Quill has none by default). */
.xk-comment-compose .rich-editor-wrap .ql-editor { min-height: 72px; }
.xk-comment-compose .rich-editor-wrap:focus-within .ql-toolbar.ql-snow,
.xk-comment-compose .rich-editor-wrap:focus-within .ql-container.ql-snow {
    border-color: var(--bs-primary);
}

/* ── List/table content pattern (14 pages — tasks, goals, users, …) ─────
   Ports public_html/style.css's .section-header/.filter-bar/.task-row/
   .users-table rules onto this theme layer's --bs-* tokens, same porting
   approach as the rest of this file. Two row shapes share the filter bar
   and modal: a card-row list (most pages — hover, badges, wraps naturally
   on mobile since it's already a flex column) and a literal <table> (used
   by users.php/agents.php/database.php/logs.php — wrapped in
   .table-responsive so dense tabular data scrolls horizontally on mobile
   instead of losing columns). See docs/frontend_layout.md
   ("Pattern-to-page mapping") for which pages use which shape. */

.xk-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.xk-section-title-group {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.xk-section-header h1 { font-size: 1.375rem; font-weight: 600; margin: 0; }
.xk-section-hint {
    color: var(--bs-secondary-color);
    font-size: .875rem;
    margin: -.75rem 0 1.25rem;
}

.xk-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-bottom: 1.25rem;
}
.xk-filter-chip {
    background: none;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-tertiary-color);
    border-radius: 20px;
    padding: .3rem .8rem;
    font-size: .8rem;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.xk-filter-chip:hover  { border-color: var(--bs-tertiary-color); color: var(--bs-body-color); }
.xk-filter-chip.active { border-color: #38bdf8; color: #38bdf8; background: rgba(56,189,248,.08); }
.xk-filter-chip--toggle { margin-left: auto; border-style: dashed; }
.xk-filter-chip--toggle.active { border-style: solid; }
.xk-filter-input,
.xk-filter-select {
    width: auto;
    min-width: 200px;
    font-size: .85rem;
    padding: .28rem .75rem;
    border-radius: 20px;
}
@media (max-width: 575.98px) {
    .xk-filter-input, .xk-filter-select { min-width: 0; flex: 1 1 140px; }
    .xk-filter-chip--toggle { margin-left: 0; }
}

.xk-row-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.xk-row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 9px;
    padding: .85rem 1.1rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-decoration: none;
    color: inherit;
    flex-wrap: wrap;
    min-width: 0;
}
.xk-row-item:hover { border-color: #475569; background: #253347; }
.xk-row-item--static { cursor: default; }
.xk-row-item--static:hover { border-color: var(--bs-border-color); background: var(--bs-secondary-bg); }
/* Name column takes the free width; the badges wrap below it when the row is too narrow (phones), so a long
   name never squeezes to zero width or hides the state badge. Names wrap (never ellipsis-truncated). */
.xk-row-main { display: flex; flex-direction: column; gap: .2rem; min-width: 0; flex: 1 1 12rem; }
.xk-row-name {
    font-weight: 500;
    font-size: .9375rem;
    overflow-wrap: anywhere;
}
.xk-row-desc {
    font-size: .8rem;
    color: var(--bs-tertiary-color);
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.xk-row-badges { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; flex-wrap: wrap; max-width: 100%; }
/* a long project / goal name inside a row badge is cut with an ellipsis instead of widening the row */
.xk-row-badges .xk-badge { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.xk-row-badges .xk-badge--project, .xk-row-badges .xk-badge--goal { max-width: min(16rem, 70vw); }  /* viewport-based: a % max-width would not shrink the group's intrinsic width */
.xk-empty-msg { color: var(--bs-tertiary-color); font-size: .9rem; padding: 1rem 0; }

/* Literal data-table variant (users.php, agents.php, database.php, logs.php).
   .table-responsive (Bootstrap) provides the horizontal-scroll-on-mobile
   behavior — no column dropping/reflow, since tabular data (SQL results,
   log lines, budget figures) loses meaning if cards-collapsed instead. */
.xk-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.xk-data-table thead th {
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    color: var(--bs-tertiary-color);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    white-space: nowrap;
}
.xk-data-table tbody tr {
    border-bottom: 1px solid var(--bs-secondary-bg);
    transition: background .12s;
}
.xk-data-table tbody tr:last-child { border-bottom: none; }
.xk-data-table tbody tr:hover { background: #1a2638; }
.xk-data-table td { padding: .75rem 1rem; vertical-align: middle; }
.xk-td-name { font-weight: 500; }
.xk-td-actions { display: flex; gap: .4rem; align-items: center; }

/* Pagination — no current page uses server-side pagination (every list page
   client-filters a fully-fetched array), but the phase brief names it as
   part of this pattern for future large-list pages. Reuses Bootstrap's own
   .pagination component as-is; it already inherits this theme's --bs-*
   tokens with no override needed. */
.xk-pagination-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}

/* ── Work-group list pages (Phase 7: inbox, goals, projects, knowledge, routines, tasks) ──────
   Row / filter / header pieces on top of the list pattern above. Everything wraps instead of scrolling
   sideways: names break anywhere, badges and action buttons wrap below the name on phones. */

a.xk-badge { text-decoration: none; }
.xk-section-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
/* badge in the page title (tasks.php project filter): may wrap, never wider than the screen */
.xk-section-title-group { min-width: 0; max-width: 100%; }
.xk-section-title-group .xk-badge {
    max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; border-radius: 1rem;
}
.xk-badge-clear {
    background: none; border: none; color: inherit; opacity: .6; cursor: pointer;
    font-size: 1em; line-height: 1; padding: 0 .1rem;
}
.xk-badge-clear:hover { opacity: 1; }
.xk-icon-btn { padding: .2rem .5rem; line-height: 1.2; flex-shrink: 0; }

/* Routines list row: name + cron | badges, last task, next run, Spawn / Delete */
.xk-routine-cron { font-family: var(--bs-font-monospace); font-size: .75rem; color: var(--bs-tertiary-color); overflow-wrap: anywhere; }
.xk-routine-no-task { font-size: .75rem; color: var(--bs-tertiary-color); }
.xk-routine-next { font-size: .72rem; color: var(--bs-tertiary-color); white-space: nowrap; }
.xk-routine-actions { display: flex; gap: .35rem; margin-left: .25rem; }
@media (max-width: 575.98px) {
    .xk-routine-actions { flex-basis: 100%; margin-left: 0; }
}

/* Inbox */
.xk-inbox-list { display: flex; flex-direction: column; gap: .625rem; }
.xk-inbox-item {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 9px;
    padding: .875rem 1rem;
    cursor: pointer;
    min-width: 0;
    transition: border-color .15s, background .15s;
}
.xk-inbox-item:hover { border-color: #475569; background: #253347; }
.xk-inbox-item-header { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .35rem; }
.xk-inbox-item-name { font-size: .9375rem; font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* unread count: blue (#3b82f6), same as the sidebar badge — color-map.md "Inbox unread" */
.xk-unread-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; flex-shrink: 0;
    background: #3b82f6; color: #fff; font-size: .6875rem; font-weight: 700;
}
.xk-inbox-item-preview {
    color: var(--bs-secondary-color); font-size: .8125rem; margin: 0 0 .25rem; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.xk-inbox-item-time { font-size: .75rem; color: var(--bs-tertiary-color); }
.xk-inbox-messages { display: flex; flex-direction: column; gap: .75rem; }
.xk-inbox-message {
    background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 6px; padding: .75rem .875rem;
}
.xk-inbox-message-time { font-size: .75rem; color: var(--bs-tertiary-color); display: block; margin-bottom: .35rem; }
.xk-inbox-message-body { color: #cbd5e1; font-size: .875rem; margin: 0; overflow-wrap: anywhere; }
.xk-inbox-message-body p, .xk-inbox-message-body ul, .xk-inbox-message-body ol { margin: .25rem 0; }
.xk-inbox-message-body ul, .xk-inbox-message-body ol { margin-left: 1rem; padding-left: .5rem; }
.xk-inbox-message-body p:first-child { margin-top: 0; }
.xk-inbox-message-body p:last-child  { margin-bottom: 0; }

/* Knowledge base: scopes -> articles -> segments */
.xk-kb-subheader { margin-top: 1.75rem; gap: .75rem; }
.xk-kb-breadcrumb { display: flex; align-items: center; gap: .75rem; min-width: 0; flex-wrap: wrap; }
.xk-kb-breadcrumb h2 { font-size: 1.125rem; font-weight: 600; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.xk-kb-search { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex: 1 1 220px; max-width: 420px; }
.xk-kb-search .form-control { min-width: 0; }
@media (max-width: 575.98px) {
    .xk-kb-search { margin-left: 0; max-width: none; flex-basis: 100%; }
}
.xk-kb-preview { color: var(--bs-secondary-color); font-size: .8rem; margin: .25rem 0 0; line-height: 1.4; overflow-wrap: anywhere; }
.xk-kb-date { color: var(--bs-tertiary-color); font-size: .78rem; margin-left: .5rem; white-space: nowrap; }
.xk-kb-keywords { display: flex; flex-wrap: wrap; gap: .35rem; }
.xk-kb-keywords .xk-badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.xk-kb-preview + .xk-kb-keywords, .xk-row-main > .xk-kb-keywords { margin-top: .3rem; }
.xk-kb-result-label {
    color: var(--bs-tertiary-color); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: .4rem 0 .2rem;
}
.xk-kb-summary-body {
    margin-top: .5rem; padding: .75rem; background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color); border-radius: 8px; font-size: .9rem; line-height: 1.6;
    overflow-wrap: anywhere;
}
.rich-editor-wrap.xk-kb-editor .ql-editor { min-height: 200px; max-height: 45vh; }  /* 3 classes: must beat style.css's .rich-editor-wrap .ql-editor */

/* Sub-lists inside a modal (projects: allowed nodes / connected goals) */
.xk-modal-section { border-top: 1px solid var(--bs-border-color); margin-top: 1.25rem; padding-top: 1rem; }
.xk-modal-section-label {
    font-size: .75rem; font-weight: 600; color: var(--bs-tertiary-color);
    text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem;
}
.xk-sub-item {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .4rem 0; border-bottom: 1px solid var(--bs-border-color);
}
.xk-sub-item:last-child { border-bottom: none; }
.xk-sub-item > span { min-width: 0; overflow-wrap: anywhere; }
.xk-sub-empty { font-size: .85rem; color: var(--bs-tertiary-color); margin: .25rem 0 .75rem; }
.xk-sub-add-row { display: flex; gap: .5rem; margin-top: .75rem; }
.xk-sub-add-row .form-select { flex: 1; min-width: 0; }
.xk-sub-add-row .btn { flex-shrink: 0; }
/* long names in modal titles wrap instead of widening the dialog */
.modal-title { min-width: 0; overflow-wrap: anywhere; }

/* ── Dashboard content pattern (dashboard.php) ───────────────────────────
   Ports public_html/style.css's .dash-* rules onto --bs-* tokens. Adds
   responsive collapse to the 2-column grid: 1 column below 768px,
   2 columns at/above it. */

.xk-dash-refresh-hint { font-size: .8rem; color: var(--bs-tertiary-color); }

.xk-dash-grid-full { margin-bottom: 1.5rem; }
.xk-dash-grid-2 {
    display: grid;
    /* minmax(0, 1fr), not plain 1fr — a bare 1fr track still respects each
       grid item's default min-width:auto (its content's intrinsic size),
       so a wide child (e.g. .xk-dash-card-title's unwrapped title+link
       row) silently pushes the card past the viewport instead of
       shrinking. minmax(0, 1fr) resets that floor to 0, letting text
       inside wrap/ellipsis normally. Caught via CDP-measured overflow at
       375px (.xk-dash-card was 477px wide in a 375px viewport) — see
       docs/frontend_layout.md. */
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 768px) {
    .xk-dash-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.xk-dash-card {
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    min-width: 0;
}
.xk-dash-card-title {
    font-size: .75rem;
    font-weight: 600;
    color: var(--bs-tertiary-color);
    text-transform: uppercase;
    letter-spacing: .06em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.xk-dash-chart-wrap { position: relative; min-height: 200px; }

.xk-dash-task-list { display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.xk-dash-task-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem .75rem;
    border-radius: 6px;
    background: var(--bs-tertiary-bg);
    text-decoration: none;
    color: var(--bs-body-color);
    font-size: .875rem;
    transition: background .15s;
}
.xk-dash-task-item:hover { background: #1e3a5f; }
.xk-dash-task-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xk-dash-task-time { font-size: .75rem; color: var(--bs-tertiary-color); white-space: nowrap; flex-shrink: 0; }
.xk-dash-empty { color: var(--bs-tertiary-color); font-size: .875rem; text-align: center; padding: 1.25rem 0; }
.xk-dash-view-all { font-size: .8rem; color: #38bdf8; text-decoration: none; transition: color .15s; white-space: nowrap; }
.xk-dash-view-all:hover { color: #7dd3fc; }
.xk-badge--sm { font-size: .7rem; padding: .1rem .4rem; flex-shrink: 0; }

.xk-dash-nodes-grid { display: flex; flex-direction: row; flex-wrap: wrap; gap: .75rem; }
.xk-dash-node-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: .4rem;
    padding: .5rem .75rem;
    border-radius: 6px;
    background: var(--bs-tertiary-bg);
    font-size: .875rem;
    width: 200px;
    height: 100px;
    flex: 0 0 200px;
}
.xk-node-name-row { display: flex; align-items: center; gap: .5rem; width: 100%; min-width: 0; }
.xk-node-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xk-node-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.xk-node-status-dot--green  { background: #4ade80; box-shadow: 0 0 5px #4ade8077; }
.xk-node-status-dot--yellow { background: #fbbf24; box-shadow: 0 0 5px #fbbf2477; }
.xk-node-status-dot--stale  { background: #fb923c; box-shadow: 0 0 5px #fb923c77; } /* orange: stale (>120 min) AND never seen — never red (color-map.md) */
.xk-node-last-seen { font-size: .75rem; color: var(--bs-tertiary-color); }

/* ── Settings-form content pattern (email-settings.php, settings.php) ───
   Ports email-settings.php's inline <style> block onto --bs-* tokens. Adds
   a real single-column-on-mobile rule for .xk-field-row (host/port,
   encryption/from-name) — production has no @media query, so those pairs
   never stacked on narrow viewports before this phase. */

.xk-settings-form { max-width: 640px; }
.xk-form-section-title {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--bs-tertiary-color);
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: .5rem;
    margin: 1.75rem 0 1.25rem;
}
.xk-form-section-title:first-child { margin-top: 0; }

.xk-field-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.xk-field-row > .xk-field-narrow { max-width: 110px; flex-shrink: 0; }
.xk-field-row > * { flex: 1; min-width: 0; }
@media (max-width: 575.98px) {
    /* `align-items: stretch` is required: align-items acts on the CROSS axis,
       which is vertical in the desktop row (flex-start = top-aligned) but
       horizontal once this flips to a column — there, flex-start makes each
       stacked field shrink to its content width instead of filling the column.
       `gap: 1rem` is the vertical spacing between stacked fields (same as the
       `mb-3` between ordinary fields); with `gap: 0` the next label sits
       flush against the input above. */
    .xk-field-row { flex-direction: column; gap: 1rem; align-items: stretch; }
    .xk-field-row > .xk-field-narrow { max-width: none; }
}

.xk-checkbox-field { display: flex; align-items: center; gap: .625rem; margin-bottom: .875rem; }
.xk-checkbox-field input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    accent-color: var(--bs-primary);
    cursor: pointer;
}
.xk-checkbox-field label {
    margin: 0;
    text-transform: none;
    font-size: .9375rem;
    color: #cbd5e1;
    letter-spacing: 0;
    cursor: pointer;
}

.xk-form-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}
.xk-test-result {
    font-size: .875rem;
    padding: .4rem .75rem;
    border-radius: 6px;
}
.xk-test-result--ok      { background: #052e16; border: 1px solid #166534; color: #86efac; }
.xk-test-result--error   { background: #450a0a; border: 1px solid #7f1d1d; color: #fca5a5; }
.xk-test-result--pending { background: #431407; border: 1px solid #92400e; color: #fcd34d; }

/* Per-field independent-save cards (settings.php, prompts.php) ───────────
   Each card is self-contained: own input / textarea, own Save button, own "Saved." confirmation (no
   enclosing <form>). settings.js / prompts.js render them. The input is a Bootstrap .form-control /
   .form-select (+ the .setting-input JS hook), the confirmation is .xk-setting-saved (+ the
   .setting-saved-msg / .prompt-saved-msg JS hook) in the DONE green (#4ade80, color-map.md). */

.xk-setting-cards > .xk-form-section-title:first-child { margin-top: 0; }
.xk-cat-desc {
    color: var(--bs-tertiary-color);
    font-size: .875rem;
    margin: -.5rem 0 1.25rem;
}
.xk-setting-divider {
    border: none;
    border-top: 1px solid var(--bs-border-color);
    margin: 2rem 0;
    opacity: 1;
}
.xk-setting-card {
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    min-width: 0;
}
.xk-setting-card-header { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.xk-setting-card-title { font-size: 1rem; font-weight: 600; color: var(--bs-body-color); margin: 0; }
.xk-setting-card-key {
    font-size: .75rem;
    color: var(--bs-tertiary-color);
    overflow-wrap: anywhere;
}
.xk-setting-card-desc { font-size: .825rem; color: var(--bs-secondary-color); margin: .25rem 0 0; }
.xk-setting-actions { display: flex; align-items: center; gap: .75rem; }
.xk-setting-saved { font-size: .825rem; color: #4ade80; }

/* ── Admin list pages (Phase 8: users, alerts, nodes, agents, tools) ───────────
   Card rows like the work-group pages (the template's .xk-row-list), so nothing scrolls sideways on a
   phone. Extra pieces: a meta line under the name, code chips, the "New alert" menu, agent usage charts. */

/* second line under a row name: internal name, OS, model, budget, URL... — wraps, never scrolls */
.xk-row-meta {
    display: flex; flex-wrap: wrap; gap: .15rem 1rem; min-width: 0;
    font-size: .78rem; color: var(--bs-secondary-color);
}
.xk-row-meta > span { min-width: 0; overflow-wrap: anywhere; }
.xk-code {
    font-family: var(--bs-font-monospace); font-size: .78rem; color: #94a3b8;
    background: var(--bs-body-bg); padding: .1rem .35rem; border-radius: 3px; overflow-wrap: anywhere;
}
/* long command line / URL: two lines at most (full text in the title tooltip and the edit dialog) */
.xk-cmd { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.xk-row-flags { display: flex; flex-wrap: wrap; gap: .3rem; }
.xk-row-desc--full { display: block; -webkit-line-clamp: unset; }   /* no 2-line clamp (user e-mail) */
.xk-protected { font-size: .775rem; color: var(--bs-tertiary-color); font-style: italic; white-space: nowrap; }
.xk-row-item--inactive .xk-row-main { opacity: .5; }   /* disabled user: the name dims, the badge + Enable button stay readable */
.xk-badge--mono { font-family: var(--bs-font-monospace); }

/* Tool flag badges (color-map.md "Tool flags"): "Not available to plan" is amber (attention, not red) */
.xk-badge--restricted { color: #fbbf24; background: #3a2e0f; border-color: #7a5b13; }
.xk-badge--different  { color: #f8ae71; background: #2b2012; border-color: #7f5d1d; }

/* Enable button on a disabled user (legacy "enable" green) */
.btn-outline-success {
    --bs-btn-color: #4ade80;
    --bs-btn-border-color: #166534;
    --bs-btn-hover-color: #4ade80;
    --bs-btn-hover-bg: rgba(74, 222, 128, .08);
    --bs-btn-hover-border-color: #4ade80;
    --bs-btn-active-color: #4ade80;
    --bs-btn-active-bg: rgba(74, 222, 128, .15);
    --bs-btn-active-border-color: #4ade80;
}

/* "New alert" type menu: toggled with the `hidden` class by alerts.js (Bootstrap's own dropdown JS is not used) */
.xk-dropdown { position: relative; }
.xk-dropdown-menu {
    display: block; position: absolute; top: calc(100% + 6px); right: 0; left: auto; margin: 0;
    min-width: 11rem; z-index: 1000;
}
.xk-dropdown-menu .dropdown-item { cursor: pointer; }

/* Checkbox / switch labels: sentence case (the legacy global `label` rule would upper-case them) */
.form-check-label { text-transform: none; letter-spacing: 0; font-size: .9375rem; color: #cbd5e1; margin: 0; cursor: pointer; }

/* inputs the page JS marks read-only (internal name when editing, locked built-in tool fields) */
.form-control.input-readonly { opacity: .55; cursor: default; }

/* Agents: one card per agent with its two usage charts underneath (full width of the card) */
.xk-agent-charts { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 1rem; min-width: 0; }
.xk-agent-chart-block { flex: 1 1 16rem; min-width: 0; }
.xk-agent-chart-label {
    font-size: .72rem; color: var(--bs-tertiary-color); margin-bottom: 4px;
    text-transform: uppercase; letter-spacing: .04em;
}
.xk-agent-chart-wrap { position: relative; height: 110px; }

/* Tools: reorder dialog rows (arrows first, then the name) */
.xk-reorder-row { justify-content: flex-start; }
.xk-reorder-btns { display: flex; gap: .25rem; flex-shrink: 0; }
.xk-reorder-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ── Admin pages, group B (Phase 9: prompts, settings, database, logs) ───────────
   prompts.php / settings.php use the setting cards above; database.php / logs.php are "fixed-viewport" pages. */

/* Setting cards on a phone: a little less padding so inputs and the prompt editor get the width */
@media (max-width: 575.98px) {
    .xk-setting-card { padding: 1rem; }
}
.xk-setting-actions { flex-wrap: wrap; }

/* prompts.php: wider than the 640px settings form (long monospace text), variable chips, editor */
.xk-prompt-cards { max-width: 960px; }
.xk-prompt-vars { display: flex; flex-wrap: wrap; gap: .35rem; min-width: 0; }
.xk-prompt-var code {
    display: inline-block;
    background: var(--bs-body-bg);
    border: 1px solid #1e3a5f;
    padding: .15em .5em;
    border-radius: 4px;
    font-size: .75rem;
    cursor: default;
    overflow-wrap: anywhere;
}
/* `textarea.` prefix: Bootstrap's `textarea.form-control { min-height }` (0,1,1) would otherwise win */
textarea.xk-prompt-textarea {
    min-height: 320px;
    font-family: var(--bs-font-monospace);
    font-size: .8rem;
    line-height: 1.65;
    resize: vertical;
}
@media (max-width: 575.98px) {
    textarea.xk-prompt-textarea { min-height: 18rem; }
}

/* Fixed-viewport pages (database.php, logs.php): the page itself never scrolls; the result / log area fills what is
   left of the screen and scrolls inside itself. >=992px the body is a flex row (sidebar | main), so <main> stretches
   to the body height; below it the body is a flex column (mobile topbar, then <main> takes the rest).
   Fallback: on a very short screen (landscape phone) the area keeps a 12rem minimum and <main> scrolls instead of
   clipping the query box. 100dvh = the visible height on phones with a collapsing address bar. */
body.xk-fixed-page { height: 100vh; height: 100dvh; overflow: hidden; }
.xk-main--fill { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.xk-main--fill > * { flex-shrink: 0; }
.xk-main--fill > .xk-fill-area { flex: 1 1 0; min-height: 12rem; overflow: auto; }

/* database.php */
.xk-db-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.xk-db-chips .xk-filter-chip { font-size: .78rem; padding: .2rem .65rem; }
@media (max-width: 575.98px) {
    /* ~30 table names would eat the whole phone screen: one row that scrolls sideways instead */
    .xk-db-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .4rem; }
    .xk-db-chips .xk-filter-chip { flex-shrink: 0; }
}
.xk-db-query { display: flex; flex-direction: column; gap: .75rem; }
textarea.xk-sql-input {
    font-family: var(--bs-font-monospace);
    font-size: .9rem;
    min-height: 120px;
    max-height: 40vh;
    resize: vertical;
}
@media (max-width: 575.98px) {
    textarea.xk-sql-input { min-height: 5.5rem; }
}
.xk-db-query + .xk-fill-area { margin-top: 1rem; }
.xk-sql-echo {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    padding: .6rem .85rem;
    margin: 0 0 .75rem;
    font-family: var(--bs-font-monospace);
    font-size: .85rem;
    color: var(--bs-secondary-color);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
/* result table: the result area is the scroll container (no .table-responsive wrapper needed) */
.xk-data-table--db { font-size: .85rem; }
.xk-data-table--db th,
.xk-data-table--db td { padding: .4rem .75rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.xk-data-table--db thead th { position: sticky; top: 0; background: var(--bs-card-bg); }
.xk-db-cell { display: -webkit-box; -webkit-line-clamp: 10; -webkit-box-orient: vertical; overflow: hidden; }
.xk-db-cell--clipped { cursor: pointer; }
.xk-db-cell--clipped:hover { color: #93c5fd; }
.xk-db-write-msg { color: #86efac; font-size: .9rem; margin: 0; }

/* logs.php */
.xk-log-search { display: flex; gap: .5rem; flex: 1 1 14rem; max-width: 26rem; }
.xk-log-area {
    background: #000;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    padding: .6rem;
    font-family: var(--bs-font-monospace);
    font-size: .85rem;
}
.xk-log-empty { color: var(--bs-tertiary-color); font-size: .85rem; padding: .5rem 0; margin: 0; }
.xk-log-table { width: 100%; border-collapse: collapse; }
.xk-log-table tr + tr { border-top: 1px solid #111827; }
.xk-log-table td {
    padding: 3px 8px;
    vertical-align: top;
    white-space: pre-wrap;
    overflow-wrap: anywhere;   /* context JSON: long unbroken strings wrap anywhere */
    color: #f1f5f9;
}
.xk-log-table td:nth-child(4) { min-width: 12rem; }   /* message: never squeezed below a readable width, a 25-character identifier still fits */
.xk-log-table td:first-child { white-space: nowrap; color: #64748b; }
.xk-log-table td:nth-child(2) { white-space: nowrap; width: 70px; font-weight: 600; }
.xk-log-table td:nth-child(3) { white-space: nowrap; color: #94a3b8; }
/* level colors (color-map.md "Log levels"): error is the one red line, warning amber, debug cyan */
.xk-log-table tr.xk-log-level--error td   { color: #ef4444; }
.xk-log-table tr.xk-log-level--warning td { color: #fbbf24; }
.xk-log-table tr.xk-log-level--debug td   { color: #22d3ee; }
@media (max-width: 1199.98px) {
    /* narrow screens (phones, tablets, small laptops with the sidebar open): one entry = a short header line
       (time, level, source) with the message and context under it, instead of five squeezed columns */
    .xk-log-table, .xk-log-table tbody, .xk-log-table tr { display: block; }
    .xk-log-table tr { padding: .35rem 0; }
    .xk-log-table td { display: inline-block; padding: 0 .6rem 0 0; }   /* inline-block, not inline: the line can wrap between time / level / source */
    .xk-log-table td:nth-child(2) { width: auto; }
    .xk-log-table td:nth-child(n+4) { display: block; padding: 0; }
    .xk-log-table td:empty { display: none; }
}
