/* ============================================================
   LC Shell — "Ink Rail" sidebar + topbar
   Loaded AFTER all Hope UI css; overrides shell visuals only.
   Shared --b-* token language with settings/documents/tools.
   ============================================================ */
:root {
    --b-primary: #1a448a;
    --b-primary-light: #eef3fc;
    --b-primary-dark: #0d2f66;
    --b-success: #059652;
    --b-success-light: #ecfdf3;
    --b-danger: #dc2626;
    --b-danger-light: #fef2f2;
    --b-warning: #d97706;
    --b-warning-light: #fef3c7;
    --b-text: #1a2332;
    --b-text-secondary: #6b7280;
    --b-text-muted: #9ca3af;
    --b-border: #e8ecf1;
    --b-bg: #f8f9fb;
    --b-card: #ffffff;
    --b-radius: 16px;
    --b-radius-sm: 10px;
    --b-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    --b-shadow-hover: 0 4px 20px rgba(26,68,138,0.08);
}

body { background-color: var(--b-bg) !important; }

/* ---------- Sidebar card ---------- */
.sidebar.lc-shell {
    --sidebar-width: 248px;
    display: flex;
    flex-direction: column;
    top: 0;
    bottom: 0;
    left: 0;
    border: none;
    border-radius: 0;
    background: var(--b-primary) !important;
    box-shadow: 2px 0 16px rgba(13, 47, 102, 0.10);
    overflow: hidden;
}
.sidebar.lc-shell.sidebar-mini { --sidebar-width: 76px; }
/* General sibling (~), not adjacent (+): the .lc-drawer-scrim div sits between
   the aside and main, which silently kills + rules (incl. Hope UI's own). */
.sidebar.lc-shell ~ .main-content {
    --sidebar-width: 248px;
    margin-left: var(--sidebar-width);
    transition: margin-left 400ms ease-in-out;
}
.sidebar.lc-shell.sidebar-mini ~ .main-content { --sidebar-width: 76px; }

/* Brand */
.lc-side-brand {
    display: flex; align-items: center; gap: 9px;
    padding: 16px 18px 8px; flex-shrink: 0; text-decoration: none;
}
.lc-side-brand .lc-logo {
    width: 32px; height: 32px; border-radius: 8px; background: #fff;
    display: none; align-items: center; justify-content: center; flex-shrink: 0;
}
.lc-side-brand .lc-logo img { width: 20px; }
/* Full wordmark logo shown when the sidebar is expanded. */
.lc-side-brand .lc-brand-full {
    height: 30px; width: auto; display: block;
}
/* Collapsed rail: hide the wordmark, fall back to the square check icon. */
.sidebar.lc-shell.sidebar-mini .lc-brand-full { display: none; }
.sidebar.lc-shell.sidebar-mini .lc-logo { display: flex; }
.sidebar.lc-shell.sidebar-mini .lc-side-brand { justify-content: center; padding-left: 0; padding-right: 0; }

/* Search */
.lc-side-search {
    display: flex; align-items: center; gap: 8px;
    margin: 6px 14px 8px; padding: 7px 11px; flex-shrink: 0;
    border-radius: 9px; background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.12);
}
.lc-side-search svg { color: rgba(255,255,255,0.5); flex-shrink: 0; }
.lc-side-search input {
    background: transparent; border: none; outline: none; width: 100%;
    font-size: 0.8rem; color: #fff;
}
.lc-side-search input::placeholder { color: rgba(255,255,255,0.5); }
.sidebar.lc-shell.sidebar-mini .lc-side-search { display: none; }

/* Scroll area */
.sidebar.lc-shell .sidebar-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
    padding: 0; height: auto;
}
.sidebar.lc-shell .sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar.lc-shell .sidebar-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 2px; }
.sidebar.lc-shell .sidebar-body::-webkit-scrollbar-track { background: transparent; }

/* Group labels */
.lc-nav-group {
    list-style: none;
    font-size: 0.62rem; letter-spacing: 1.4px; text-transform: uppercase;
    font-weight: 700; color: rgba(255,255,255,0.55);
    /* left padding aligns group heading with the icon column */
    padding: 14px 20px 4px 24px;
}
.sidebar.lc-shell.sidebar-mini .lc-nav-group {
    height: 1px; padding: 0; margin: 10px 20px 9px;
    background: rgba(255,255,255,0.18); overflow: hidden;
}
.sidebar.lc-shell.sidebar-mini .lc-nav-group span { display: none; }

/* Nav items — overrides .sidebar-default .nav-link rules */
.sidebar.lc-shell .navbar-nav { padding: 0; }
.sidebar.lc-shell .nav-item.lc-nav-item { margin: 0; padding: 0 !important; /* Hope UI .nav-item adds padding-left:16px */ }
.sidebar.lc-shell .nav-link {
    display: flex; align-items: center; gap: 10px;
    margin: 1px 12px; padding: 8px 12px;
    border-radius: 9px; font-size: 0.84rem; font-weight: 500;
    /* !important: Hope UI's sidebar-white/sidebar-default rules outrank us on some pages */
    color: rgba(255,255,255,0.92) !important;
    white-space: nowrap;
}
.sidebar.lc-shell .nav-link .icon { display: flex; flex-shrink: 0; color: inherit; }
.sidebar.lc-shell .nav-link .item-name {
    overflow: hidden; text-overflow: ellipsis;
    /* Hope UI adds margin-left:16px on top of our flex gap */
    margin-left: 0 !important;
}
.sidebar.lc-shell .nav-link:hover:not(.active) {
    /* !important: Hope UI hover paints --bs-primary-bg-subtle (near-white) over us */
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
    box-shadow: none !important;
}
.sidebar.lc-shell .nav-link.active {
    background: rgba(255,255,255,0.15) !important; color: #fff !important;
    font-weight: 600; box-shadow: none;
}
.sidebar.lc-shell.sidebar-mini .nav-link {
    justify-content: center; padding: 9px 0; margin: 2px 16px; gap: 0;
}
.sidebar.lc-shell.sidebar-mini .item-name { display: none; }

/* Pinned footer (Settings) */
.lc-side-foot {
    flex-shrink: 0; border-top: 1px solid rgba(255,255,255,0.12);
    padding: 6px 0 10px; margin-top: 4px;
}

/* "Need help?" support block in the pinned footer.
   Scoped under .sidebar.lc-shell + !important on colors so Hope UI's
   sidebar text-color rules (which are !important) don't override us —
   same defensive reason .nav-link uses !important above. */
.sidebar.lc-shell .lc-side-help {
    margin: 6px 12px 2px;
    padding: 9px 11px;
    border-radius: 11px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.09);
}
.sidebar.lc-shell .lc-help-head {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase;
    color: #9fbcf2 !important;
    margin-bottom: 4px;
}
.sidebar.lc-shell .lc-help-head svg { flex-shrink: 0; color: #9fbcf2 !important; opacity: 0.95; }
.sidebar.lc-shell .lc-help-line {
    font-size: 0.66rem; line-height: 1.5;
    color: rgba(255,255,255,0.58) !important;
}
.sidebar.lc-shell .lc-help-line .lc-help-ticket {
    color: #bcd0f7 !important; font-weight: 600; text-decoration: none;
    border-bottom: 1px solid rgba(188,208,247,0.4);
    transition: color 0.2s, border-color 0.2s;
}
.sidebar.lc-shell .lc-help-line .lc-help-ticket:hover { color: #fff !important; border-color: rgba(255,255,255,0.8); }
.sidebar.lc-shell .lc-help-line .lc-help-phone {
    display: inline-flex; align-items: center; gap: 3px;
    color: #83ddad !important; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.sidebar.lc-shell .lc-help-line .lc-help-phone svg { color: #83ddad !important; opacity: 0.95; }
.sidebar.lc-shell .lc-help-line .lc-help-phone:hover { color: #a6ecc7 !important; }
.sidebar.lc-shell .lc-help-disclaimer {
    margin: 6px 0 0; padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.55rem; line-height: 1.5;
    color: rgba(255,255,255,0.4) !important;
}
/* Collapse cleanly in the mini rail */
.sidebar.lc-shell.sidebar-mini .lc-side-help { display: none; }

/* Floating collapse chevron straddling the sidebar edge, vertically centered */
.lc-side-collapse {
    position: fixed;
    top: 50%;
    left: calc(248px - 14px);
    transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%;
    background: #fff;
    border: 1.5px solid var(--b-border);
    box-shadow: var(--b-shadow);
    color: var(--b-text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; z-index: 911;
    transition: left 400ms ease-in-out;
}
.lc-side-collapse:hover { color: var(--b-primary); border-color: #d3e0f5; }
.lc-side-collapse svg { transition: transform 300ms ease; }
.sidebar.lc-shell.sidebar-mini ~ .lc-side-collapse { left: calc(76px - 14px); }
.sidebar.lc-shell.sidebar-mini ~ .lc-side-collapse svg { transform: rotate(180deg); }

/* ---------- Topbar card ---------- */
.iq-navbar.lc-shell-top {
    position: sticky; top: 0; z-index: 900;
    margin: 0;
    background: var(--b-card) !important;
    border: none;
    border-bottom: 1.5px solid var(--b-border);
    border-radius: 0;
    box-shadow: none;
}
.iq-navbar.lc-shell-top .navbar-inner {
    display: flex; align-items: center; gap: 12px; padding: 11px 20px;
}
/* Hope UI's scroll script (hope-ui.js) adds .menu-sticky on scroll to pin the
   topbar via position:fixed — lc-shell relies on this because the topbar's
   .iq-banner parent is too short for the CSS `position:sticky` to span the page.
   Hope UI's matching width rule targets `.sidebar + .main-content` (adjacent
   sibling), but lc-shell's .lc-drawer-scrim div sits between the aside and
   .main-content (see note above .main-content), killing that rule — so the bar
   falls back to width:100% and overflows past the sidebar, trimming the right
   side (help + avatar) off-screen. Re-apply the correct offset/width using the
   same --sidebar-width var the navbar already inherits from .main-content. */
.iq-navbar.lc-shell-top.navs-sticky.menu-sticky {
    left: var(--sidebar-width) !important;
    right: auto !important;
    width: calc(100% - var(--sidebar-width)) !important;
    transition: left 400ms ease-in-out, width 400ms ease-in-out;
}
.lc-shell-top .sidebar-toggle {
    cursor: pointer; color: var(--b-text-secondary);
    display: flex; align-items: center;
    position: static; background: transparent; padding: 4px;
}
.lc-shell-top .sidebar-toggle:hover { color: var(--b-text); }
.lc-top-burger {
    display: flex;
    border: 1.5px solid var(--b-border); background: #fff; border-radius: 9px;
    width: 36px; height: 36px; align-items: center; justify-content: center;
    color: var(--b-text); flex-shrink: 0; cursor: pointer;
}
.lc-top-title { font-size: 1.1rem; font-weight: 700; color: var(--b-text); white-space: nowrap; }
.lc-top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lc-top-company { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.lc-top-company b { font-size: 0.875rem; color: var(--b-text); font-weight: 600; }
.lc-top-company small { font-size: 0.74rem; color: var(--b-text-muted); }
.lc-shell-top select.form-select {
    /* Match the 36px height of .lc-icon-btn / avatar so the topbar controls line
       up edge-to-edge. !important beats Bootstrap's py-1 (which otherwise forces
       a shorter 32px box and leaves the dropdown looking inset from its neighbours). */
    height: 36px !important; line-height: 1.2;
    border: 1.5px solid var(--b-border) !important; border-radius: 9px !important;
    background-color: var(--b-bg); box-shadow: none !important;
    font-size: 0.875rem; font-weight: 600; color: var(--b-text) !important;
    /* min-width keeps the box from shrink-wrapping the label, so the caret pins to
       the right edge with clear separation from the text instead of crowding it. */
    padding: 7px 30px 7px 12px; min-width: 188px; max-width: 250px;
}
.lc-icon-btn {
    width: 36px; height: 36px; border-radius: 9px;
    border: 1.5px solid var(--b-border); background: #fff;
    display: flex; align-items: center; justify-content: center;
    color: var(--b-text-secondary);
}
.lc-icon-btn:hover { background: var(--b-bg); color: var(--b-text); }
/* 6h idle session-timeout countdown pill (dist/assets/js/session-timeout.js) */
.lc-session-pill {
    display: flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px; border-radius: 9px;
    border: 1.5px solid var(--b-border); background: #fff;
    color: var(--b-text-secondary); font-size: 0.8rem; font-weight: 600;
    font-variant-numeric: tabular-nums; white-space: nowrap;
    transition: var(--b-transition);
}
.lc-session-pill svg { flex-shrink: 0; }
.lc-session-pill.lc-session-pill-warn { border-color: var(--b-warning); background: var(--b-warning-light); color: var(--b-warning); }
.lc-session-pill.lc-session-pill-expired { border-color: var(--b-danger); background: var(--b-danger-light); color: var(--b-danger); }
.lc-audit-btn {
    width: auto; padding: 0 12px; gap: 6px;
    font-size: 0.8rem; text-decoration: none;
}
.lc-prof-chip { display: flex; align-items: center; gap: 9px; }
.lc-prof-chip .lc-av {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; background: var(--b-primary-light);
    border: 1.5px solid #d3e0f5;
}
.lc-prof-chip .lc-prof-nm { font-size: 0.875rem; font-weight: 600; color: var(--b-text); line-height: 1.2; }
.lc-prof-chip .lc-prof-rl { font-size: 0.74rem; color: var(--b-text-muted); }
.lc-shell-top .dropdown-menu {
    border: 1.5px solid var(--b-border); border-radius: var(--b-radius-sm);
    box-shadow: var(--b-shadow-hover);
}

/* ---------- Mobile drawer (< xl, matches sidebar.js 1199.9 breakpoint) ---------- */
.lc-drawer-scrim {
    display: none; position: fixed; inset: 0;
    background: rgba(13,20,35,0.45); z-index: 905;
}
@media (max-width: 1199.98px) {
    .sidebar.lc-shell,
    .sidebar.lc-shell.sidebar-mini {
        --sidebar-width: 248px;
        transform: translateX(-100%);
    }
    body.lc-drawer-open .sidebar.lc-shell { transform: none; }
    body.lc-drawer-open .lc-drawer-scrim { display: block; }
    .lc-side-collapse { display: none; }
    .sidebar.lc-shell ~ .main-content,
    .sidebar.lc-shell.sidebar-mini ~ .main-content { --sidebar-width: 0px; margin-left: 0; }
    /* drawer always renders the FULL sidebar even when sidebar.js added .sidebar-mini.
       Hope UI hides mini labels via opacity/transform (not display), so reset all three. */
    .sidebar.lc-shell.sidebar-mini .item-name {
        display: inline !important;
        opacity: 1 !important;
        transform: none !important;
        font-size: inherit !important;
    }
    .sidebar.lc-shell.sidebar-mini .lc-side-search { display: flex; }
    .sidebar.lc-shell.sidebar-mini .lc-brand-full { display: block; }
    .sidebar.lc-shell.sidebar-mini .lc-logo { display: none; }
    .sidebar.lc-shell.sidebar-mini .lc-side-brand { justify-content: flex-start; padding: 16px 18px 8px; }
    .sidebar.lc-shell.sidebar-mini .lc-nav-group { height: auto; background: transparent; margin: 0; padding: 14px 20px 4px; overflow: visible; }
    .sidebar.lc-shell.sidebar-mini .lc-nav-group span { display: inline; }
    .sidebar.lc-shell.sidebar-mini .nav-link { justify-content: flex-start; padding: 8px 12px; margin: 1px 12px; gap: 10px; }
    .lc-top-title { overflow: hidden; text-overflow: ellipsis; }
}
