/* ==========================================================================
   Home (apps grid) — a 1:1 port of the ERP's (Logic Leap Workspace) home
   screen: .ll-home / .ll-home-bar / .ll-home-content / .ll-home-search /
   .ll-apps-grid / .ll-app / .ll-app-icon / .ll-app-name. Sizes, radii,
   shadows, gradients and the hover lift are the ERP's own; colours come from
   the platform's --ll-* tokens (styles.css) so both themes work.
   Used by home.html (full page) and dashboard.html (.ll-home-embed, the grid
   sits above the KPIs).
   ========================================================================== */

:root {
    --ll-fs: 1;                                   /* ERP font-scale (1 = default) */
    --ll-primary-rgb: var(--ll-purple-rgb);
    --ll-surface-rgb: 26 15 40;                   /* --ll-panel as r g b */
    --ll-hero-a: .38;                             /* top-right purple bloom */
    --ll-hero-b: .18;                             /* bottom-left magenta bloom */
    --ll-home-glow: rgb(var(--ll-accent-rgb) / .45);   /* ERP --ll-glow (a colour) */
    --ll-home-icon-shadow: 0 10px 24px -10px rgba(0, 0, 0, .8);
}
:root[data-theme="light"] {
    --ll-surface-rgb: 255 255 255;
    --ll-hero-a: .12;
    --ll-hero-b: .07;
    --ll-home-glow: rgb(var(--ll-accent-rgb) / .28);
    --ll-home-icon-shadow: 0 10px 24px -10px rgb(var(--ll-fg-rgb) / .45);
}

/* ---- page ------------------------------------------------------------- */
.ll-home {
    position: relative;
    min-height: 100%;
    overflow-x: clip;
    background:
        radial-gradient(900px 520px at 85% -10%, rgb(var(--ll-primary-rgb) / var(--ll-hero-a)), transparent 62%),
        radial-gradient(760px 520px at 0% 105%, rgb(var(--ll-accent-rgb) / var(--ll-hero-b)), transparent 60%),
        var(--ll-ink);
    background-attachment: fixed;
}
/* faint 48px grid, faded out towards the edges */
.ll-home::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgb(var(--ll-accent-rgb) / .06) 1px, transparent 1px),
        linear-gradient(90deg, rgb(var(--ll-accent-rgb) / .06) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
            mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}
.ll-home > * { position: relative; }

/* ---- bar (brand + end controls) ---------------------------------------- */
.ll-home-bar {
    height: var(--ll-navbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}
.ll-home-bar .ll-brandmark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 40px;
    flex: 0 1 auto;
    max-width: 100%;
    overflow: hidden;
    direction: ltr;
}
.ll-home-bar .ll-brandmark .ll-product { font-size: calc(12px * var(--ll-fs)); }
.ll-home-bar .ll-navbar-end { display: flex; align-items: center; gap: 4px; }
.ll-home-bar .ll-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: var(--ll-radius);
    background: transparent;
    color: var(--ll-muted);
    cursor: pointer;
    transition: background-color .12s, color .12s;
}
.ll-home-bar .ll-icon-btn:hover { background: rgb(var(--ll-accent-rgb) / .08); color: var(--ll-text); }
.ll-home-bar .ll-icon-btn svg { width: 18px; height: 18px; }

/* ---- content ------------------------------------------------------------ */
.ll-home-content {
    max-width: 980px;
    margin: 0 auto;
    padding: 30px 16px 64px;
}

.ll-home-search { max-width: 560px; margin: 0 auto 44px; }
.ll-home-search input {
    width: 100%;
    height: 48px;
    padding: 0 24px;
    border: 1px solid var(--ll-hairline);
    border-radius: 24px;
    background: rgb(var(--ll-surface-rgb) / .75);
    box-shadow: 0 2px 0 0 var(--ll-magenta), 0 12px 30px -16px var(--ll-home-glow);
    font: inherit;
    font-size: calc(15px * var(--ll-fs));
    color: var(--ll-text);
    outline: none;
    -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
    transition: border-color .15s, box-shadow .15s;
}
:root[data-theme="light"] .ll-home-search input { background: rgb(var(--ll-surface-rgb) / .82); }
.ll-home-search input::placeholder { color: var(--ll-muted-2); }
.ll-home-search input:focus {
    border-color: var(--ll-purple);
    box-shadow: 0 2px 0 0 var(--ll-magenta), 0 14px 34px -12px var(--ll-home-glow);
}

/* ---- groups (the sidebar's sections, same order) ----------------------- */
.ll-home-group { margin-bottom: 36px; }
.ll-home-group[hidden] { display: none; }
.ll-home-group-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    font-size: calc(12.5px * var(--ll-fs));
    font-weight: 700;
    color: var(--ll-muted);
}
.ll-home-group-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--ll-hairline-soft);
}
.ll-home .ll-muted { color: var(--ll-muted); }
.ll-home-empty { text-align: center; }
.ll-home-empty[hidden] { display: none; }

/* ---- apps grid --------------------------------------------------------- */
.ll-apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 136px);
    justify-content: center;
    gap: 30px 0;
}
.ll-app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 11px;
    width: 136px;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    border-radius: var(--ll-radius);
    cursor: pointer;
    font: inherit;
    color: var(--ll-text);
    text-decoration: none;
}
.ll-app[hidden] { display: none; }
.ll-app:focus-visible { outline: 2px solid var(--ll-magenta); }

.ll-app-icon {
    position: relative;
    width: 74px;
    height: 74px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--ll-hairline);                       /* overridden inline per tile */
    box-shadow: var(--ll-home-icon-shadow), inset 0 1px rgba(255, 255, 255, .18);
    transition: transform .18s, box-shadow .18s;
}
.ll-app-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(160deg, rgba(255, 255, 255, .2), transparent 55%);
    pointer-events: none;
}
.ll-app-icon svg {
    position: relative;
    width: 34px;
    height: 34px;
    stroke-width: 1.7;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25));
}
.ll-app:hover .ll-app-icon,
.ll-app:focus-visible .ll-app-icon {
    transform: translateY(-3px);
    box-shadow: 0 16px 30px -10px var(--ll-home-glow), inset 0 1px rgba(255, 255, 255, .18);
}
.ll-app-name {
    font-size: calc(14.5px * var(--ll-fs));
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    color: var(--ll-text-2);
}
.ll-app:hover .ll-app-name { color: var(--ll-text); }

@media (max-width: 640px) {
    .ll-apps-grid { grid-template-columns: repeat(auto-fill, 108px); }
    .ll-app { width: 108px; }
}
@media (prefers-reduced-motion: reduce) {
    .ll-app-icon, .ll-home-search input { transition: none; }
    .ll-app:hover .ll-app-icon { transform: none; }
}

/* ---- embedded on the dashboard (above the KPIs) ------------------------ */
.ll-home-embed {
    min-height: 0;
    overflow: clip;
    margin-bottom: 1.75rem;
    border: 1px solid var(--ll-hairline-soft);
    border-radius: var(--ll-radius-lg);
    background-attachment: scroll;
}
.ll-home-embed::before { position: absolute; }
.ll-home-embed .ll-home-content { padding-bottom: 20px; }
.ll-home-embed .ll-home-search { margin-bottom: 32px; }
.ll-home-embed .ll-home-group { margin-bottom: 26px; }
.ll-home-embed .ll-home-group:last-of-type { margin-bottom: 0; }

/* ---- full page (home.html): fill the content column ------------------- */
.ll-home-page { padding: 0; max-width: none; min-height: 100vh; display: flex; flex-direction: column; }
.ll-home-page > .ll-home { flex: 1; }
