html, body { max-width: 100vw; overflow-x: hidden; }

.public-shell {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: 0 1fr auto;
    grid-template-areas:
        "header header"
        "sidebar main"
        "footer footer";
    min-height: 100vh;
}
.public-main {
    grid-area: main;
    min-height: calc(100vh - 64px - 40px);
    padding-top: 72px !important;
    padding-bottom: 60px !important;
    background: var(--main-bg, transparent);
}
.lx-sidebar {
    grid-area: sidebar;
    width: 60px;
    background: var(--chrome-bg, #14182a);
    border: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: fixed;
    left: 0;
    top: 64px;
    height: calc(100vh - 64px - 40px);
    transition: width .2s ease;
    z-index: 100;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.lx-sidebar::-webkit-scrollbar { display: none; width: 0; height: 0; }
.lx-sidebar:hover,
.lx-sidebar:focus-within { width: 240px; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
.lx-sidebar-nav { display: flex; flex-direction: column; padding: 12px 0 24px; }
.lx-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: var(--text-muted, #9ca3af);
    text-decoration: none;
    font-size: .9em;
    white-space: nowrap;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.lx-sidebar-link:hover,
.lx-sidebar-link:focus-visible { color: var(--text-primary, #fff); background: rgba(255,255,255,0.04); }
.lx-sidebar-link:focus,
.lx-sidebar-link:focus-visible {
    outline: 2px solid var(--brand-500, #8b5cf6);
    outline-offset: -2px;
}
.lx-sidebar-link.active { color: var(--brand-400, #8b5cf6); border-left-color: var(--brand-500, #8b5cf6); background: rgba(139,92,246,0.12); }
.lx-sidebar-icon { flex: 0 0 24px; display: inline-flex; align-items: center; justify-content: center; }
.lx-sidebar-label { opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s; pointer-events: none; }
.lx-sidebar:hover .lx-sidebar-label,
.lx-sidebar:focus-within .lx-sidebar-label { opacity: 1; transform: translateX(0); }

.public-header {
    grid-area: header;
    display: flex !important;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 64px;
    background: var(--chrome-bg, #14182a);
    border: 0;
    color: var(--text-primary, #f1f4f9);
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9998 !important;
}
.public-header .sidebar-brand { width: 240px; min-height: 36px; display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 600; flex-shrink: 0; }
.public-header .sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.public-header .sidebar-brand-subtitle { font-size: .68em; font-weight: 500; color: var(--text-muted, #9ba5b8); letter-spacing: .02em; }
.public-header .sidebar-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand-500, #8b5cf6), var(--teal-400, #06b6d4));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.public-header-search { flex: 1; max-width: 480px; position: relative; }
.public-header-search input {
    width: 100%;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--chrome-bg, #14182a);
    border: none;
    color: var(--text-primary, #f1f4f9);
    font-family: inherit;
    font-size: .9em;
}
.public-header-search input::placeholder { color: var(--text-muted, #9ba5b8); opacity: 1; }
.public-header-search input:focus-visible,
.public-header-search input:focus,
.public-header-select select:focus,
.public-header-select select:focus-visible,
.public-header .btn:focus,
.public-header .btn:focus-visible,
.public-header-hamburger:focus,
.public-header-hamburger:focus-visible,
.public-user-trigger:focus,
.public-user-trigger:focus-visible,
.public-user-item:focus,
.public-user-item:focus-visible,
.public-company-trigger:focus,
.public-company-trigger:focus-visible,
.public-company-item:focus,
.public-company-item:focus-visible {
    outline: 2px solid var(--brand-500, #8b5cf6);
    outline-offset: 2px;
}
.public-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.public-header-form { margin: 0; }
.public-header-select select {
    min-height: 34px;
    border-radius: 6px;
    border: none;
    background: var(--chrome-bg, #14182a);
    color: var(--text-primary, #f1f4f9);
    padding: 0 10px;
    font: inherit;
    font-size: .9em;
    font-weight: 700;
}
.public-header-actions .btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: .9em;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    color: var(--text-primary, #f1f4f9);
    background: var(--chrome-bg, #14182a);
    font-weight: 700;
    cursor: pointer;
}
.public-header-actions .btn-primary { background: var(--chrome-bg, #14182a); border: none; color: var(--text-primary, #f1f4f9); }
.public-header-actions .btn-icon { width: 36px; min-width: 36px; height: 36px; padding: 0; }
.public-notification-bell { position: relative; }
.public-notification-trigger { position: relative; }
.public-notification-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger-fg, #f43f5e);
    color: #fff;
    font-size: .65rem;
    line-height: 16px;
    font-weight: 800;
    text-align: center;
}
.public-notification-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    background: var(--chrome-bg, #14182a);
    border: 1px solid var(--chrome-border, rgba(255,255,255,.10));
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
    z-index: 230;
    overflow: hidden;
}
.public-notification-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--chrome-border, rgba(255,255,255,.10));
    font-size: .88em;
}
.public-notification-head button,
.public-notification-view-all {
    background: transparent;
    border: 0;
    color: var(--brand-400, #8b5cf6);
    cursor: pointer;
    font: inherit;
    font-size: .85em;
    font-weight: 800;
}
.public-notification-head button:focus-visible,
.public-notification-view-all:focus-visible,
.public-notification-item:focus-visible {
    outline: 2px solid var(--brand-500, #8b5cf6);
    outline-offset: 2px;
}
.public-notification-list {
    max-height: 320px;
    overflow-y: auto;
}
.public-notification-item {
    display: grid;
    grid-template-columns: 8px 1fr;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--chrome-border, rgba(255,255,255,.10));
    color: inherit;
    cursor: pointer;
    text-align: left;
}
.public-notification-item:hover,
.public-notification-item.is-unread { background: rgba(139,92,246,0.12); }
.public-notification-dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--text-muted, #9ca3af);
}
.public-notification-item.is-unread .public-notification-dot { background: var(--teal-400, #06b6d4); }
.public-notification-item strong,
.public-notification-item span,
.public-notification-item time { display: block; }
.public-notification-item strong { font-size: .9em; }
.public-notification-item span,
.public-notification-item time {
    margin-top: 3px;
    color: var(--text-muted, #9ca3af);
    font-size: .78em;
    line-height: 1.35;
}
.public-notification-empty {
    margin: 0;
    padding: 22px 12px;
    color: var(--text-muted, #9ca3af);
    font-size: .86em;
    text-align: center;
}
.public-notification-view-all {
    width: 100%;
    padding: 10px 12px;
    border-top: 1px solid var(--chrome-border, rgba(255,255,255,.10));
}
.public-company-switcher { position: relative; }
.public-company-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
    min-height: 34px;
    padding: 4px 10px;
    background: var(--chrome-bg, #14182a);
    border: none;
    border-radius: 18px;
    color: inherit;
    cursor: pointer;
}
.public-company-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--brand-500, #8b5cf6);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.18);
    flex: 0 0 auto;
}
.public-company-current { min-width: 0; display: grid; line-height: 1.05; text-align: left; }
.public-company-label { color: var(--text-muted, #9ca3af); font-size: .66em; font-weight: 700; text-transform: uppercase; }
.public-company-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85em; font-weight: 700; }
.public-company-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--chrome-bg, #14182a);
    border: 1px solid var(--chrome-border, rgba(255,255,255,.10));
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
    min-width: 280px;
    max-width: min(340px, calc(100vw - 24px));
    z-index: 220;
    display: none;
    padding: 6px;
}
.public-company-switcher.open .public-company-dropdown { display: block; }
.public-company-help {
    margin: 0 0 4px;
    padding: 8px 10px;
    color: var(--text-muted, #9ca3af);
    font-size: .78em;
    line-height: 1.35;
}
.public-company-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
}
.public-company-item:hover,
.public-company-item.active { background: rgba(139,92,246,0.12); }
.public-company-item-main { min-width: 0; display: grid; gap: 2px; }
.public-company-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9em; font-weight: 700; }
.public-company-item-role { color: var(--text-muted, #9ca3af); font-size: .78em; }
.public-company-active {
    flex: 0 0 auto;
    color: var(--brand-400, #8b5cf6);
    font-size: .72em;
    font-weight: 800;
    text-transform: uppercase;
}
.public-user-menu { position: relative; }
.public-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--chrome-bg, #14182a);
    border: none;
    border-radius: 20px;
    color: inherit;
    cursor: pointer;
}
.public-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-500, #8b5cf6), var(--teal-400, #06b6d4));
    color: #fff;
    font-weight: 700;
    font-size: .85em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.public-user-role { font-size: .85em; font-weight: 500; }
.public-user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--chrome-bg, #14182a);
    border: 1px solid var(--chrome-border, rgba(255,255,255,.10));
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
    min-width: 180px;
    z-index: 200;
    display: none;
    padding: 6px;
}
.public-user-menu.open .public-user-dropdown { display: block; }
.public-user-item {
    display: block;
    padding: 8px 12px;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    font-size: .9em;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
}
.public-user-item:hover { background: rgba(139,92,246,0.12); color: var(--brand-400, #8b5cf6); }
.public-user-logout { color: var(--danger-fg, #f87171); }

.public-footer {
    grid-area: footer;
    padding: 10px 24px;
    background: var(--chrome-bg, #14182a);
    border: 0;
    color: var(--text-muted, #9ca3af);
    font-size: .85em;
    min-height: 40px !important;
    line-height: 1.3;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999 !important;
    display: flex !important;
}
.public-footer-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; width: 100%; }
.public-footer-meta { margin-right: auto; }
.public-footer-links { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.public-footer-links a { color: var(--text-muted, #9ca3af); text-decoration: none; }
.public-footer-links a:hover { color: var(--brand-400, #8b5cf6); }

.lx-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--chrome-bg, #14182a);
    border: 1px solid var(--chrome-border, rgba(255,255,255,.10));
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 200;
}
.lx-search-dropdown[hidden] { display: none; }
.lx-search-group { padding: 8px 12px 4px; font-size: .7em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.lx-search-item { display: block; padding: 8px 12px; color: inherit; text-decoration: none; border-radius: 6px; font-size: .9em; }
.lx-search-item:hover,
.lx-search-item.active { background: rgba(139,92,246,0.15); color: var(--text-primary, #fff); }
.lx-search-item code { font-size: .8em; color: var(--text-muted); margin-right: 6px; }
.lx-search-item small { display: block; color: var(--text-muted); font-size: .85em; margin-top: 2px; }
.lx-search-empty { padding: 12px; color: var(--text-muted); font-size: .9em; text-align: center; }
.lx-search-footer { padding: 8px 12px; border-top: 1px solid var(--chrome-border); font-size: .8em; color: var(--text-muted); }

.public-header-hamburger {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: var(--chrome-bg, #14182a);
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
}


@media (max-width: 900px) {
    .public-shell { grid-template-columns: 1fr; grid-template-areas: "header" "main" "footer"; }
    .lx-sidebar { left: -260px; width: 260px; height: calc(100vh - 64px); top: 64px; }
    .public-shell.sidebar-open .lx-sidebar { left: 0; }
    .public-shell.sidebar-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; }
    .lx-sidebar:hover { box-shadow: none; }
    .lx-sidebar-label { opacity: 1; transform: none; }
    .public-header-hamburger { display: inline-flex; }
    .public-header-search { display: none; }
    .public-header .sidebar-brand { width: auto; }
    .public-header .sidebar-brand-name { display: none; }
    .public-user-role { display: none; }
    .public-company-label { display: none; }
    .public-company-trigger { max-width: 150px; }
    .public-main { padding: 72px 16px 60px !important; }
}
