/**
 * m000 - 工具平台首页
 */

html, body { min-height: 100%; }

body {
    background: var(--color-bg);
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 120vh;
    min-height: 760px;
    background:
        radial-gradient(circle at 18% 8%, var(--color-aurora-accent), transparent 28rem),
        radial-gradient(circle at 86% 12%, var(--color-aurora-success), transparent 26rem);
    pointer-events: none;
    z-index: 0;
}

.workspace-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* ── 顶栏 ─────────────────────────────────────────────── */

.topbar {
    width: min(1180px, calc(100% - 48px));
    height: 66px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-button {
    border: 0;
    background: transparent;
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    cursor: pointer;
    transition: opacity .16s ease;
}
.brand-button:hover { opacity: .82; }

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-accent) 13%, white);
    color: var(--color-accent);
    font-weight: 800;
    box-shadow: 0 1px 0 rgba(46,37,32,.04);
}

.brand-text {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-link {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    border-radius: 999px;
    transition: background .16s ease, color .16s ease;
    padding: 8px 13px;
    font-size: 14px;
}
.topbar-link:hover {
    background: color-mix(in srgb, var(--color-accent) 8%, transparent);
    color: var(--color-accent);
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: rgba(255,255,255,.52);
    border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
    color: var(--color-text);
    max-width: 180px;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}
.user-pill:hover {
    background: rgba(255,255,255,.68);
    border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border));
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-text);
    color: var(--color-surface);
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}

.user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

/* ── 主内容区 ──────────────────────────────────────────── */

.workspace-main {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 18px 0 60px;
}

.view { display: none; }
.view.is-active { display: block; }

/* ── 问候区 ────────────────────────────────────────────── */

.hero {
    padding: 28px 0 20px;
}
.hero-title {
    margin: 0;
    color: var(--color-text);
    font-size: clamp(1.75rem, 3.5vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -.04em;
    font-weight: 760;
}

/* ── 首页搜索框 ────────────────────────────────────────── */

.home-search-wrap {
    position: relative;
    margin-bottom: 8px;
}

.home-search-input {
    width: 100%;
    height: 52px;
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--color-border) 60%, white);
    background: rgba(255,255,255,.78);
    color: var(--color-text);
    font-size: 15px;
    padding: 0 48px 0 48px;
    box-shadow: 0 8px 28px rgba(46,37,32,.06);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.home-search-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border));
    background: rgba(255,255,255,.96);
    box-shadow: 0 12px 36px rgba(204,120,92,.10);
}

.home-search-icon {
    position: absolute;
    left: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    font-size: 19px;
    pointer-events: none;
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--color-border) 40%, transparent);
    color: var(--color-muted);
    cursor: pointer;
    display: none;
    font-size: 18px;
    line-height: 1;
}
.search-clear-btn.is-visible {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.search-clear-btn:hover {
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-border) 70%, transparent);
}

/* ── 内联搜索结果 ──────────────────────────────────────── */

.home-search-results {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 24px;
}
.home-search-results.hidden { display: none; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background .12s ease;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover {
    background: color-mix(in srgb, var(--color-accent) 5%, transparent);
}
.search-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-accent) 9%, white);
    font-size: 18px;
    flex: 0 0 auto;
}
.search-result-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--color-text);
}
.search-result-desc {
    font-size: .78rem;
    color: var(--color-muted);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-result-empty {
    padding: 18px 16px;
    color: var(--color-muted);
    font-size: .85rem;
    text-align: center;
}

/* ── 区块通用 ──────────────────────────────────────────── */

.section-block {
    margin-top: 28px;
    margin-bottom: 4px;
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.section-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.section-meta {
    color: var(--color-muted);
    font-size: 12px;
    white-space: nowrap;
}
.section-action {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: color .15s ease, background .15s ease;
}
.section-action:hover {
    color: var(--color-danger);
    background: color-mix(in srgb, var(--color-danger) 8%, transparent);
}

/* ── 继续使用：横向紧凑卡片 ────────────────────────────── */

.compact-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.compact-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,.60);
    border: 1px solid color-mix(in srgb, var(--color-border) 60%, white);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(46,37,32,.04);
    transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.compact-card:hover {
    background: rgba(255,255,255,.88);
    border-color: color-mix(in srgb, var(--color-accent) 22%, var(--color-border));
    transform: translateY(-1px);
}
.compact-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-accent) 9%, white);
    font-size: 16px;
    flex: 0 0 auto;
}
.compact-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

.compact-empty {
    color: var(--color-muted);
    font-size: .82rem;
    padding: 4px 0;
}

/* ── 首页模块卡片（图标 + 名称，两行） ─────────────────── */

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 10px;
}

.module-card {
    position: relative;
    min-height: 108px;
    border: 1px solid var(--color-border-soft);
    background: var(--color-surface-glass);
    border-radius: 16px;
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
    padding: 13px;
    display: grid;
    grid-template-rows: 38px 1fr;
    align-content: space-between;
    gap: 9px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(8px);
    transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.module-card:hover {
    background: var(--color-surface-glass-strong);
    border-color: color-mix(in srgb, var(--color-accent) 18%, white);
    box-shadow: var(--shadow-float);
    transform: translateY(-1px);
}

.favorite-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.82);
    color: var(--color-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(46,37,32,.08);
    transition: transform .16s ease, color .16s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.favorite-toggle:hover { transform: scale(1.08); color: var(--color-accent); }
.favorite-toggle.is-active { color: #d89a1d; }

.card-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-accent) 9%, white);
    font-size: 21px;
    flex: 0 0 auto;
}

.card-title {
    margin: 0;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── 空状态 ────────────────────────────────────────────── */

.empty-card {
    border-radius: 16px;
    background: var(--color-surface-soft);
    border: 1px dashed color-mix(in srgb, var(--color-border) 75%, transparent);
    padding: 20px;
    color: var(--color-muted);
}
.empty-title { color: var(--color-text); font-weight: 700; margin-bottom: 4px; font-size: .9rem; }
.empty-desc { font-size: .8rem; line-height: 1.6; }

/* ── 查看全部应用 ───────────────────────────────────────── */

.view-all-wrap {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}
.view-all-link {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    font-size: .88rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: color .15s ease, background .15s ease;
}
.view-all-link:hover {
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 6%, transparent);
}

/* ── 账号面板 ──────────────────────────────────────────── */

.identity-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
}
.identity-panel-overlay.hidden { display: none; }
.identity-panel-overlay.is-visible { background: rgba(0,0,0,.4); }

.identity-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: min(420px, 90%);
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .2s ease, transform .2s ease;
}
.identity-panel.is-visible { opacity: 1; transform: translateY(0); }

.identity-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}
.identity-panel-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}
.identity-panel-close {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s ease;
}
.identity-panel-close:hover {
    background: color-mix(in srgb, var(--color-border) 40%, transparent);
}

.identity-panel-body {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.account-field { display: flex; flex-direction: column; gap: 6px; }
.account-field-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.account-field-row { display: flex; align-items: center; gap: 8px; }
.account-field-value {
    flex: 1;
    font-size: .95rem;
    font-weight: 600;
    color: var(--color-text);
    font-family: var(--font-mono);
    word-break: break-all;
}
.account-field-value.is-masked {
    color: var(--color-muted);
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: .85rem;
    font-style: italic;
}

.first-time-banner {
    background: color-mix(in srgb, var(--color-warning) 10%, var(--color-surface));
    border: 1px solid color-mix(in srgb, var(--color-warning) 30%, var(--color-border));
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: .82rem;
    color: var(--color-text);
    line-height: 1.6;
}
.first-time-banner strong { color: var(--color-warning); }

.panel-divider { height: 1px; background: var(--color-border); margin: 4px 0; }

.switch-form { display: flex; flex-direction: column; gap: 10px; }
.switch-form .input { font-size: .9rem; }

.disclaimer-dialog { text-align: left; }
.disclaimer-title { font-size: 1rem; font-weight: 700; color: var(--color-text); margin-bottom: 10px; }
.announcement-time { color: var(--color-muted); font-size: 12px; margin-bottom: 10px; }
.disclaimer-list { margin: 0; padding-left: 20px; color: var(--color-muted); line-height: 1.7; }
.disclaimer-list li + li { margin-top: 6px; }

/* ── 回到顶部 ──────────────────────────────────────────── */

.back-to-top {
    position: fixed;
    right: 26px;
    bottom: 26px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.88);
    color: var(--color-accent);
    box-shadow: 0 12px 30px rgba(46,37,32,.12);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.back-to-top:hover { background: rgba(255,255,255,.98); }
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* ── 响应式 ────────────────────────────────────────────── */

@media (max-width: 760px) {
    body::before { height: 96vh; min-height: 640px; }
    .topbar, .workspace-main { width: min(100% - 28px, 1180px); }
    .topbar { height: 60px; }
    .brand-text { max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .user-name { display: none; }
    .topbar-actions { gap: 6px; }
    .topbar-link { padding: 7px 10px; font-size: 13px; }
    .workspace-main { padding-bottom: 40px; }
    .hero { padding: 20px 0 16px; }
    .hero-title { font-size: 1.65rem; }
    .home-search-input { height: 48px; border-radius: 16px; font-size: 14px; }
    .modules-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
    .module-card { min-height: 96px; padding: 11px; border-radius: 14px; }
    .card-icon { width: 34px; height: 34px; border-radius: 11px; font-size: 19px; }
    .card-title { font-size: 12px; }
    .identity-panel-overlay { align-items: flex-end; }
    .identity-panel { width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 85vh; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: .01ms !important; }
}
