/* 应用入口页（index.html）：应用图标网格 */

.hub-body {
    background: linear-gradient(180deg, #eef4f1 0%, var(--pane) 260px);
}

.hub-main {
    height: calc(100% - var(--title-h));
    overflow: auto;
    padding: 24px 16px 32px;
}

.hub-intro {
    max-width: 1080px;
    margin: 0 auto 18px;
}

.hub-intro h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--title-fg);
}

.hub-intro p {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.app-grid {
    max-width: 1080px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 6px 14px;
    background: var(--surface);
    border: 1px solid #e3e8e5;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.12s ease, box-shadow 0.12s ease,
        border-color 0.12s ease;
}

.app-item:hover {
    transform: translateY(-2px);
    border-color: #cfd8d3;
    box-shadow: 0 8px 20px rgba(28, 43, 40, 0.1);
}

.app-item:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.app-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 10px rgba(28, 43, 40, 0.16);
}

.app-icon svg {
    width: 62%;
    height: 62%;
}

.app-name {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

.app-desc {
    display: none;
}

/* 图标配色 */
.app-icon--chat {
    background: linear-gradient(145deg, #0f6cbd, #4fb3f4);
}

.app-icon--music {
    background: linear-gradient(145deg, #5b5fc7, #a5aef3);
}

.app-icon--player {
    background: linear-gradient(145deg, #c2410c, #f6a25c);
}

.app-icon--analyze {
    background: linear-gradient(145deg, #0e7c3a, #57c68b);
}

.app-icon--distribute {
    background: linear-gradient(145deg, #0e7490, #45c6de);
}

.app-icon--warehouse {
    background: linear-gradient(145deg, #3f4b5b, #7d8b9d);
}

.app-icon--inbound {
    background: linear-gradient(145deg, #4d7c0f, #a7d64b);
}

.app-icon--download {
    background: linear-gradient(145deg, #6d28d9, #b79bf5);
}

.app-icon--user {
    background: linear-gradient(145deg, #a21caf, #e879c7);
}

/* 下载入口：整卡点击即下载，教程入口在右上角空白处，与图标留出间距 */
.app-cell {
    position: relative;
}

/* .app-item 的 display:flex 会盖掉 hidden 属性，未登录时要显式收起 */
.app-item[hidden] {
    display: none;
}

.app-cell .app-item {
    height: 100%;
    padding-top: 40px;
}

.app-item-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 12px;
}

.app-item-link:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.app-help {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eaf0ee;
    color: var(--title-muted);
    transition: color 0.12s ease, background 0.12s ease;
}

.app-help svg {
    width: 16px;
    height: 16px;
}

.app-help:hover {
    background: var(--blue);
    color: #fff;
}

.app-help:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* PC：图标整体放大，仍保持一排 4 个 */
@media (min-width: 721px) {
    .hub-main {
        padding: 40px 32px 48px;
    }

    .app-grid {
        gap: 22px;
    }

    .app-item {
        gap: 14px;
        padding: 26px 16px 30px;
        border-radius: 18px;
    }

    .app-icon {
        width: 96px;
        height: 96px;
        border-radius: 24px;
    }

    .app-item-link {
        border-radius: 18px;
    }

    .app-help {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }

    .app-help svg {
        width: 19px;
        height: 19px;
    }

    .app-cell .app-item {
        padding-top: 26px;
    }

    .app-name {
        font-size: 16px;
    }

    .app-desc {
        display: block;
        font-size: 12px;
        color: var(--muted);
        text-align: center;
        line-height: 1.45;
    }
}

/* 窄屏 PC：卡片较窄时给右上角入口留出竖向间距，避免与图标相切 */
@media (min-width: 721px) and (max-width: 999px) {
    .app-cell .app-item {
        padding-top: 50px;
    }
}

/* 超小屏仍保持一排 4 个，只压缩间距与字号 */
@media (max-width: 400px) {
    .app-grid {
        gap: 8px;
    }

    .app-item {
        padding: 10px 4px 12px;
    }

    .app-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .app-name {
        font-size: 11px;
    }
}

/* 移动端标题栏更矮，内容区随之计算高度 */
@media (max-width: 768px) {
    .hub-main {
        height: calc(100vh - 46px);
        padding: 16px 10px 24px;
    }

    .hub-intro {
        margin-bottom: 12px;
    }

    .hub-intro h2 {
        font-size: 15px;
    }

    .hub-intro p {
        font-size: 12px;
    }
}
