/* ============================================================================
 * work-history.css — the Work mode sidebar (assets/js/work-history.js).
 * Projects as folders with their chats nested under them, then loose chats.
 * Rows reuse the app's .history-user styles; this only adds the structure.
 * ========================================================================== */

.chats-history.is-work-view .wa-recent-label { display: none !important; }
html.app-chat .chats-history.is-work-view .wa-recent-label { display: revert !important; }

.wh-sec { padding: 2px 0 10px; }
.wh-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 28px;
    padding: 0 4px 0 10px;
    margin-top: 6px;
}
.wh-head-t {
    color: var(--subheading-color);
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.02em;
}
.wh-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--subheading-color);
    cursor: pointer;
    flex: none;
    transition: background 0.14s ease, color 0.14s ease, opacity 0.14s ease;
}
.wh-icon-btn .material-symbols-rounded { font-size: 17px; }
.wh-icon-btn:hover { background: var(--hover-bg-strong, rgba(245, 238, 230, 0.1)); color: var(--text-color); }
.wh-icon-btn:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }

/* ── a project ────────────────────────────────────────────────────────── */
.wh-proj { margin: 1px 0; }
.wh-proj-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 4px 0 4px;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: background 0.14s ease;
}
.wh-proj-row:hover { background: var(--hover-bg, rgba(245, 238, 230, 0.065)); }
.wh-proj-row:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
.wh-proj.is-current > .wh-proj-row { background: var(--hover-bg-strong, rgba(245, 238, 230, 0.095)); }
.wh-chev {
    display: inline-grid;
    place-items: center;
    width: 18px;
    flex: none;
    color: var(--subheading-color);
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.wh-chev .material-symbols-rounded { font-size: 17px; }
.wh-proj.is-open > .wh-proj-row .wh-chev { transform: rotate(90deg); }
.wh-fold { display: inline-flex; width: 20px; height: 16px; flex: none; }
.wh-fold .wd-svg { width: 20px; height: 16px; }
.wh-fold > .material-symbols-rounded { font-size: 17px; color: var(--subheading-color); }
.wh-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 550;
}
.wh-dev { display: inline-flex; color: var(--subheading-color); opacity: 0.8; }
.wh-dev .material-symbols-rounded { font-size: 14px; }
.wh-proj.is-offline .wh-title { color: var(--subheading-color); }

/* ⋯ and ✎ — revealed on hover / focus, kept while the menu is open. */
.wh-acts { display: inline-flex; align-items: center; gap: 1px; flex: none; margin-left: auto; }
.wh-acts .wh-icon-btn { width: 24px; height: 24px; border-radius: 6px; }
.wh-proj-row .wh-acts .wh-icon-btn { opacity: 0; }
.wh-proj-row:hover .wh-acts .wh-icon-btn,
.wh-proj-row:focus-within .wh-acts .wh-icon-btn,
.wh-proj.is-menu-open > .wh-proj-row .wh-acts .wh-icon-btn,
.wh-proj.is-current > .wh-proj-row .wh-new { opacity: 1; }
.wh-proj.is-menu-open > .wh-proj-row { background: var(--hover-bg-strong, rgba(245, 238, 230, 0.095)); }
.wh-menu-btn[aria-expanded="true"] { background: var(--hover-bg-strong, rgba(245, 238, 230, 0.1)); color: var(--text-color); }
@media (hover: none) { .wh-proj-row .wh-acts .wh-icon-btn { opacity: 1; } }

/* nested chats */
.wh-kids { display: none; }
.wh-proj.is-open > .wh-kids { display: block; }
.nav-menu .chats-history .wh-kids .history-user {
    min-height: 32px !important;
    padding-left: 32px !important;
    font-size: 12.5px !important;
}
.nav-menu .chats-history .wh-kids .history-user > .icon:not(.chat-more-btn .icon) { display: none !important; }
.nav-menu .chats-history .wh-kids .history-user.pinned > .icon:not(.chat-more-btn .icon) {
    display: inline-grid !important;
    width: 16px !important;
    font-size: 13px !important;
    margin-left: -20px !important;
    margin-right: 4px !important;
}
.wh-more {
    display: block;
    width: 100%;
    height: 28px;
    padding: 0 0 0 32px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--subheading-color);
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}
.wh-more:hover { color: var(--text-color); background: var(--hover-bg, rgba(245, 238, 230, 0.065)); }

.wh-empty-proj {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin: 2px 0;
    padding: 10px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.wh-empty-proj:hover { background: var(--hover-bg, rgba(245, 238, 230, 0.065)); }
.wh-empty-proj .material-symbols-rounded { font-size: 19px; color: var(--accent); margin-top: 1px; }
.wh-empty-proj b { display: block; font-size: 13px; font-weight: 600; }
.wh-empty-proj small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--subheading-color); }
.wh-none { margin: 2px 10px 0; font-size: 12px; color: var(--subheading-color); }

/* ── project menu (⋯ / right-click) ───────────────────────────────────── */
.wh-card {
    position: fixed;
    z-index: 100010;
    width: 250px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--secondary-color);
    color: var(--text-color);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.32);
    font-size: 12.5px;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.14s ease, transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}
.wh-card.is-up { transform: translateY(4px) scale(0.98); transform-origin: bottom right; }
.wh-card.is-in { opacity: 1; transform: none; }
.wh-card-h { display: flex; align-items: center; gap: 8px; padding: 4px 6px 6px; }
.wh-card-h b { font-size: 13.5px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    color: var(--subheading-color);
}
.wh-card-row .material-symbols-rounded { font-size: 16px; }
.wh-card-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--subheading-color); flex: none; margin-left: auto; }
.wh-dot.is-on { background: #22a06b; }
.wh-card-sep { height: 1px; margin: 6px 2px; background: var(--border-color); }
.wh-card-act {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.wh-card-act .material-symbols-rounded { font-size: 17px; color: var(--subheading-color); }
.wh-card-act:hover, .wh-card-act:focus-visible { background: var(--hover-bg-strong, rgba(245, 238, 230, 0.1)); outline: none; }

/* ── Work landing: the project control under the title ─────────────────── */
.wh-greet-sub {
    display: flex;
    justify-content: center;
    margin: 12px 0 0;
}
.wh-greet-proj {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: min(420px, 90vw);
    height: 32px;
    padding: 0 8px 0 11px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 999px;
    background: transparent;
    color: var(--subheading-color, #9aa0a6);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.wh-greet-proj:hover { background: var(--hover-bg, rgba(245, 238, 230, 0.065)); color: var(--text-color); }
.wh-greet-proj:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
.wh-greet-proj.is-set { color: var(--text-color); }
.wh-gp-ico { display: inline-grid; place-items: center; width: 18px; height: 16px; flex: none; }
.wh-gp-ico .wd-svg { width: 18px; height: 15px; }
.wh-gp-ico .material-symbols-rounded { font-size: 17px; color: var(--subheading-color); }
.wh-gp-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-gp-sub { flex: none; color: var(--subheading-color); font-weight: 400; }
.wh-gp-sub::before { content: "·"; margin: 0 5px 0 1px; }
.wh-gp-chev { display: inline-grid; place-items: center; flex: none; color: var(--subheading-color); }
.wh-gp-chev .material-symbols-rounded { font-size: 18px; }
html.app-chat .wh-greet-sub { display: none; }

/* "+" menu rows carry a one-line explanation. */
.wh-add-menu { width: 272px; }
.wh-add-menu .wh-card-act { height: auto; min-height: 42px; padding: 6px 8px; align-items: flex-start; }
.wh-add-menu .wh-card-act > .material-symbols-rounded { margin-top: 2px; }
.wh-act-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wh-act-txt > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-act-txt small { font-size: 11.5px; color: var(--subheading-color); line-height: 1.3; }
.wh-card-act.is-off { opacity: 0.55; }

/* ── loading skeleton (Chat ⇄ Work switch, first load) ────────────────── */
.wh-skel { display: flex; flex-direction: column; gap: 9px; padding: 14px 10px 10px; }
.wh-skel i {
    display: block;
    height: 13px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--text-color, #eee) 6%, transparent) 0%,
        color-mix(in srgb, var(--text-color, #eee) 11%, transparent) 45%,
        color-mix(in srgb, var(--text-color, #eee) 6%, transparent) 90%);
    background-size: 240% 100%;
    animation: wh-shimmer 1.3s ease-in-out infinite;
}
.wh-skel i.is-head { width: 34%; height: 9px; margin-top: 6px; }
.wh-skel i.is-short { width: 62%; }
@keyframes wh-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (prefers-reduced-motion: reduce) {
    .wh-chev, .wh-card { transition: none; }
    .wh-skel i { animation: none; }
}
