/* ===== 聚合导航 - 手机版 (PWA) ===== */
/* 版本: v2 - SPA 多页面 (home/tools/memo/me) + 内嵌登录 */

:root {
    --m-primary: #4f46e5;
    --m-primary-soft: #eef2ff;
    --m-bg: #f5f6fa;
    --m-card: #ffffff;
    --m-text: #1e293b;
    --m-text-muted: #64748b;
    --m-text-light: #94a3b8;
    --m-border: #e2e8f0;
    --m-radius: 14px;
    --m-radius-sm: 10px;
    --m-topbar-h: 52px;
    --m-tabbar-h: 60px;
    --m-safe-bottom: env(safe-area-inset-bottom, 0px);
    /* 调色板 (链接卡片首字符头像背景) */
    --m-c-blue: #3b82f6;
    --m-c-indigo: #6366f1;
    --m-c-purple: #a855f7;
    --m-c-pink: #ec4899;
    --m-c-red: #ef4444;
    --m-c-orange: #f97316;
    --m-c-yellow: #eab308;
    --m-c-green: #22c55e;
    --m-c-teal: #14b8a6;
    --m-c-cyan: #06b6d4;
    --m-c-gray: #64748b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* 全局兜底: 确保 hidden 属性始终生效(防止被 display:flex/grid 等覆盖) */
[hidden] { display: none !important; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--m-bg);
    color: var(--m-text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    padding-top: var(--m-topbar-h);
    padding-bottom: calc(var(--m-tabbar-h) + var(--m-safe-bottom));
}

/* ===== 顶部 TopBar ===== */
.m-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--m-topbar-h);
    background: var(--m-card);
    border-bottom: 1px solid var(--m-border);
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.m-topbar-inner {
    height: 100%;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.m-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.m-brand-icon { font-size: 22px; }
.m-brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--m-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.m-topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.m-icon-btn {
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--m-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}
.m-icon-btn:active { background: var(--m-primary-soft); color: var(--m-primary); }

/* ===== 搜索栏(可折叠) ===== */
.m-search-wrap {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--m-card);
    border-bottom: 1px solid var(--m-border);
    padding: 8px 14px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.m-search-wrap[hidden] { display: none !important; }
.m-search-wrap input {
    flex: 1;
    height: 36px;
    padding: 0 36px 0 12px;
    border: 1px solid var(--m-border);
    border-radius: 8px;
    background: var(--m-bg);
    font-size: 14px;
    outline: none;
    font-family: inherit;
    color: var(--m-text);
    -webkit-appearance: none;
    transition: border-color 0.15s, background 0.15s;
}
.m-search-wrap input:focus {
    border-color: var(--m-primary);
    background: var(--m-card);
}
.m-search-clear {
    position: absolute;
    right: 22px;
    width: 24px; height: 24px;
    border-radius: 50%;
    border: none;
    background: #cbd5e1;
    color: white;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ===== 分类 Tab 横向滚动 ===== */
.m-cat-tabs {
    background: var(--m-card);
    border-bottom: 1px solid var(--m-border);
    position: sticky;
    top: var(--m-topbar-h);
    z-index: 50;
}
.m-cat-tabs-inner {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.m-cat-tabs-inner::-webkit-scrollbar { display: none; }
.m-cat-tab {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 16px;
    background: var(--m-bg);
    color: var(--m-text-muted);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.m-cat-tab.active {
    background: var(--m-primary);
    color: white;
    font-weight: 600;
}
.m-cat-tab:not(.active):active { background: var(--m-primary-soft); }

/* ===== 区块标题 ===== */
.m-section-title {
    padding: 14px 16px 8px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--m-text);
}
.m-section-count {
    font-size: 12px;
    color: var(--m-text-light);
    font-weight: 400;
}

/* ===== 主体网格 ===== */
.m-main { padding: 0 0 24px; }
.m-grid {
    padding: 0 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.m-card {
    background: var(--m-card);
    border-radius: var(--m-radius);
    padding: 12px 10px 10px;
    text-align: center;
    text-decoration: none;
    color: var(--m-text);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 96px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.m-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.12);
}
.m-card-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    background: var(--cat-color, #4f46e5);
    overflow: hidden;
    flex-shrink: 0;
}
.m-card-icon img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 10px;
}
.m-card-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--m-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.m-card-url {
    font-size: 10px;
    color: var(--m-text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    direction: rtl;
    unicode-bidi: plaintext;
}

/* ===== 加载/空/错误状态 ===== */
.m-loading, .m-empty, .m-error {
    padding: 60px 20px;
    text-align: center;
    color: var(--m-text-muted);
    font-size: 13px;
    grid-column: 1 / -1;
}
.m-spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--m-primary-soft);
    border-top-color: var(--m-primary);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: m-spin 0.8s linear infinite;
}
@keyframes m-spin { to { transform: rotate(360deg); } }
.m-empty-icon, .m-error-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.7; }
.m-empty-title, .m-error-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--m-text);
    margin-bottom: 4px;
}
.m-empty-desc, .m-error-desc { font-size: 12px; }
.m-retry-btn {
    margin-top: 12px;
    padding: 7px 18px;
    border: none;
    background: var(--m-primary);
    color: white;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
}

/* ===== 底部 TabBar ===== */
.m-tabbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--m-tabbar-h) + var(--m-safe-bottom));
    padding-bottom: var(--m-safe-bottom);
    background: var(--m-card);
    border-top: 1px solid var(--m-border);
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.m-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 0;
    background: transparent;
    border: none;
    color: var(--m-text-light);
    font-size: 11px;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}
.m-tab .m-tab-icon { font-size: 22px; line-height: 1; }
.m-tab.active { color: var(--m-primary); }
.m-tab:active { opacity: 0.6; }

/* ===== 安装提示 ===== */
.m-install-tip {
    position: fixed;
    bottom: calc(var(--m-tabbar-h) + var(--m-safe-bottom) + 8px);
    left: 12px; right: 12px;
    background: linear-gradient(135deg, #4f46e5, #8b5cf6);
    color: white;
    padding: 10px 14px;
    border-radius: var(--m-radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
    z-index: 200;
    animation: m-slideUp 0.3s ease-out;
}
@keyframes m-slideUp {
    from { transform: translateY(120%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.m-install-tip button {
    background: rgba(255,255,255,0.25);
    color: white;
    border: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ===== 暗色模式 (跟随系统) ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --m-bg: #0f172a;
        --m-card: #1e293b;
        --m-text: #f1f5f9;
        --m-text-muted: #94a3b8;
        --m-text-light: #64748b;
        --m-border: #334155;
        --m-primary-soft: #312e81;
    }
}

/* ===== 横屏适配 ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .m-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===== 卡片色板(与 PC 端保持一致) ===== */
.m-card-icon[data-color="blue"]   { background: #3B82F6; }
.m-card-icon[data-color="green"]  { background: #16A34A; }
.m-card-icon[data-color="orange"] { background: #F97316; }
.m-card-icon[data-color="red"]    { background: #EF4444; }
.m-card-icon[data-color="purple"] { background: #8B5CF6; }
.m-card-icon[data-color="cyan"]   { background: #06B6D4; }
.m-card-icon[data-color="yellow"] { background: #CA8A04; }
.m-card-icon[data-color="pink"]   { background: #EC4899; }
.m-card-icon[data-color="teal"]   { background: #14B8A6; }
.m-card-icon[data-color="indigo"] { background: #6366F1; }
.m-card-icon[data-color="lime"]   { background: #84CC16; }
.m-card-icon[data-color="default"] { background: #64748B; }

/* ==================================================
 *  v2 SPA 补充样式
 * ================================================== */

/* ----- TopBar 增强 ----- */
.m-back-btn {
    background: transparent;
    border: none;
    color: var(--m-text);
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
}
.m-back-btn[hidden] { display: none !important; }
.m-back-btn:active { background: var(--m-primary-soft); }
.m-back-btn svg { display: block; transform: scaleX(-1); }

.m-tab.active .m-tab-icon,
.m-tab.is-active .m-tab-icon { transform: scale(1.12); }
.m-tab[data-route="home"].is-active .m-tab-icon { color: var(--m-primary); }
.m-tab[data-route="tools"].is-active .m-tab-icon { color: #0ea5e9; }
.m-tab[data-route="memo"].is-active .m-tab-icon { color: #f59e0b; }
.m-tab[data-route="me"].is-active .m-tab-icon { color: #ec4899; }

/* ----- 全局加载占位 ----- */
.m-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--m-text-muted);
    font-size: 14px;
}
.m-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--m-primary-soft);
    border-top-color: var(--m-primary);
    border-radius: 50%;
    animation: m-spin 0.8s linear infinite;
    margin-bottom: 12px;
}
@keyframes m-spin { to { transform: rotate(360deg); } }

/* ----- Toast ----- */
.m-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--m-tabbar-h) + var(--m-safe-bottom) + 24px);
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 10px 16px;
    border-radius: 22px;
    font-size: 14px;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    max-width: 80vw;
    text-align: center;
    animation: m-toast-in 0.25s ease-out;
}
@keyframes m-toast-in {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ----- Modal ----- */
.m-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.m-modal[hidden] { display: none !important; }
.m-modal-mask {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    animation: m-fade-in 0.2s ease-out;
}
.m-modal-box {
    position: relative;
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    animation: m-pop-in 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes m-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-pop-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.m-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--m-border);
}
.m-modal-title { font-size: 16px; font-weight: 600; }
.m-modal-close {
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    width: 30px; height: 30px;
    border-radius: 8px;
    color: var(--m-text-muted);
    cursor: pointer;
}
.m-modal-close:active { background: var(--m-bg); }
.m-modal-body { padding: 20px; }

.m-field { margin-bottom: 14px; }
.m-field label {
    display: block;
    font-size: 13px;
    color: var(--m-text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.m-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--m-border);
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
    transition: border-color 0.15s;
}
.m-field input:focus { outline: none; border-color: var(--m-primary); }
.m-sms-row {
    display: flex;
    gap: 8px;
}
.m-sms-row input { flex: 1; }
.m-sms-btn {
    flex-shrink: 0;
    padding: 0 14px;
    border: 1px solid var(--m-primary);
    border-radius: 10px;
    background: var(--m-primary-soft);
    color: var(--m-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.m-sms-btn:active { background: var(--m-primary); color: #fff; }
.m-sms-btn:disabled {
    border-color: var(--m-border);
    background: var(--m-bg);
    color: var(--m-text-muted);
    cursor: not-allowed;
}
.m-form-err {
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 13px;
}
.m-primary-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--m-primary);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
}
.m-primary-btn:active { background: #4338ca; }
.m-primary-btn:disabled {
    background: var(--m-text-light);
    cursor: not-allowed;
}
.m-form-tip {
    text-align: center;
    font-size: 12px;
    color: var(--m-text-light);
    margin-top: 12px;
}

/* ==================================================
 *  Home (主导航) - 重用 m-grid/m-cat-tabs
 * ================================================== */
.m-cat-tabs {
    position: sticky;
    top: var(--m-topbar-h);
    background: rgba(245, 246, 250, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5;
    border-bottom: 1px solid var(--m-border);
}
.m-cat-tabs-inner {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.m-cat-tabs-inner::-webkit-scrollbar { display: none; }
.m-cat-tab {
    flex-shrink: 0;
    padding: 7px 14px;
    border-radius: 18px;
    background: var(--m-card);
    color: var(--m-text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--m-border);
    white-space: nowrap;
    transition: all 0.15s;
}
.m-cat-tab:active { transform: scale(0.96); }
.m-cat-tab.is-active {
    background: var(--m-primary);
    color: #fff;
    border-color: var(--m-primary);
}

.m-section-title {
    padding: 14px 16px 6px;
    font-size: 14px;
    color: var(--m-text-muted);
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.m-section-title .name { font-weight: 600; color: var(--m-text); font-size: 15px; }
.m-section-count { font-size: 12px; color: var(--m-text-light); }

.m-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 10px 14px 20px;
}
@media (min-width: 480px) { .m-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .m-grid { grid-template-columns: repeat(6, 1fr); } }

.m-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    background: var(--m-card);
    border-radius: var(--m-radius);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.m-card:active { transform: scale(0.96); background: var(--m-primary-soft); }
.m-card-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 16px;
    overflow: hidden;
    background: #64748b;
    flex-shrink: 0;
}
.m-card-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.m-card-name {
    font-size: 12px;
    text-align: center;
    color: var(--m-text);
    word-break: break-word;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.m-empty, .m-error {
    text-align: center;
    padding: 60px 24px;
    color: var(--m-text-muted);
}
.m-empty-icon, .m-error-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }
.m-empty-title, .m-error-title { font-size: 16px; font-weight: 600; color: var(--m-text); margin-bottom: 6px; }
.m-empty-desc, .m-error-desc { font-size: 13px; margin-bottom: 14px; }
.m-retry-btn {
    padding: 10px 20px;
    border: 1px solid var(--m-primary);
    border-radius: 22px;
    background: var(--m-primary-soft);
    color: var(--m-primary);
    font-size: 14px;
    cursor: pointer;
}

/* ==================================================
 *  Tools (工具页) - 网格 + 内嵌 iframe
 * ================================================== */
.m-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 14px;
}
@media (min-width: 480px) { .m-tools-grid { grid-template-columns: repeat(3, 1fr); } }
.m-tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    background: var(--m-card);
    border-radius: var(--m-radius);
    cursor: pointer;
    border: none;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.m-tool-card:active { transform: scale(0.97); background: var(--m-primary-soft); }
.m-tool-icon {
    font-size: 32px;
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--m-primary-soft);
}
.m-tool-name { font-size: 13px; font-weight: 600; color: var(--m-text); }
.m-tool-desc { font-size: 11px; color: var(--m-text-light); line-height: 1.3; }

.m-tool-detail {
    padding: 12px 14px 20px;
}
.m-tool-detail-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.m-tool-detail-back {
    background: transparent;
    border: none;
    color: var(--m-primary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}
.m-tool-detail-back:active { background: var(--m-primary-soft); }
.m-tool-detail-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--m-text);
}
.m-tool-detail-body {
    background: var(--m-card);
    border-radius: var(--m-radius);
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ==================================================
 *  Memo (备忘录) - 列表 + 只读查看
 * ================================================== */
.m-memo-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    background: var(--m-card);
    border-bottom: 1px solid var(--m-border);
    position: sticky;
    top: var(--m-topbar-h);
    z-index: 5;
}
.m-memo-toolbar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--m-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--m-bg);
}
.m-memo-toolbar input:focus { outline: none; border-color: var(--m-primary); }

.m-memo-list {
    padding: 12px 14px 20px;
}
.m-memo-card {
    background: var(--m-card);
    border-radius: var(--m-radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--m-border);
    cursor: pointer;
}
.m-memo-card:active { background: var(--m-primary-soft); }
.m-memo-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--m-text);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.m-memo-content {
    font-size: 13px;
    color: var(--m-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.m-memo-meta {
    font-size: 11px;
    color: var(--m-text-light);
    margin-top: 8px;
}

.m-memo-detail {
    padding: 12px 14px 20px;
}
.m-memo-detail-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--m-text);
    margin-bottom: 8px;
    line-height: 1.4;
}
.m-memo-detail-meta {
    font-size: 12px;
    color: var(--m-text-light);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--m-border);
}
.m-memo-detail-content {
    font-size: 15px;
    color: var(--m-text);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ==================================================
 *  Me (用户中心)
 * ================================================== */
.m-me-profile {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    padding: 24px 18px 32px;
    text-align: center;
    margin-bottom: 14px;
}
.m-me-avatar {
    font-size: 48px;
    width: 72px; height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px;
    backdrop-filter: blur(4px);
}
.m-me-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.m-me-username { font-size: 13px; opacity: 0.8; }
.m-me-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 12px;
    margin-top: 8px;
}

.m-me-card {
    background: var(--m-card);
    border-radius: var(--m-radius);
    margin: 0 14px 14px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.m-me-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--m-text);
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 6px;
}
.m-me-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.m-me-stat {
    background: var(--m-bg);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.m-me-stat-label { font-size: 11px; color: var(--m-text-muted); margin-bottom: 4px; }
.m-me-stat-value {
    font-size: 17px; font-weight: 700; color: var(--m-text);
}
.m-me-stat-value.expired { color: #ef4444; }
.m-me-stat-value.warning { color: #f59e0b; }
.m-me-stat-value.ok      { color: #10b981; }

.m-me-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 14px 14px;
}
.m-me-action {
    background: var(--m-card);
    border-radius: var(--m-radius);
    padding: 14px 10px;
    text-align: center;
    text-decoration: none;
    color: var(--m-text);
    border: 1px solid var(--m-border);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.m-me-action:active { background: var(--m-primary-soft); }
.m-me-action-icon { font-size: 24px; }
.m-me-action.primary { background: var(--m-primary); color: #fff; border-color: var(--m-primary); }
.m-me-action.danger  { color: #dc2626; }

.m-me-order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--m-bg);
    font-size: 13px;
}
.m-me-order-item:last-child { border-bottom: none; }
.m-me-order-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 6px;
}
.m-me-order-tag.invite  { background: #dbeafe; color: #1e40af; }
.m-me-order-tag.renewal { background: #d1fae5; color: #065f46; }
.m-me-order-tag.register { background: #ede9fe; color: #5b21b6; }
.m-me-order-amount { font-weight: 600; color: var(--m-text); }
.m-me-order-status { font-size: 12px; color: var(--m-text-muted); margin-left: 6px; }

.m-me-logout {
    width: calc(100% - 28px);
    margin: 6px 14px 24px;
    padding: 13px;
    border: 1px solid #fecaca;
    border-radius: 12px;
    background: var(--m-card);
    color: #dc2626;
    font-size: 14px;
    cursor: pointer;
}
.m-me-logout:active { background: #fef2f2; }

/* 未登录卡片 */
.m-me-notlogin {
    text-align: center;
    padding: 80px 30px 60px;
}
.m-me-notlogin-icon { font-size: 64px; opacity: 0.4; margin-bottom: 14px; }
.m-me-notlogin-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.m-me-notlogin-desc { font-size: 13px; color: var(--m-text-muted); margin-bottom: 20px; }
.m-me-notlogin-btn {
    padding: 12px 32px;
    border: none;
    border-radius: 24px;
    background: var(--m-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.m-me-notlogin-btn:active { background: #4338ca; }

/* ==================================================
 *  暗色模式 (prefers-color-scheme: dark)
 * ================================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --m-bg: #0f172a;
        --m-card: #1e293b;
        --m-text: #f1f5f9;
        --m-text-muted: #94a3b8;
        --m-text-light: #64748b;
        --m-border: #334155;
        --m-primary-soft: #312e81;
    }
    body { background: var(--m-bg); color: var(--m-text); }
    .m-modal-box { background: var(--m-card); color: var(--m-text); }
    .m-modal-head { border-bottom-color: var(--m-border); }
    .m-field input { background: #0f172a; color: var(--m-text); border-color: var(--m-border); }
    .m-form-err { background: rgba(239, 68, 68, 0.15); }
    .m-cat-tab { background: var(--m-card); color: var(--m-text-muted); border-color: var(--m-border); }
    .m-cat-tab.is-active { background: var(--m-primary); color: #fff; border-color: var(--m-primary); }
    .m-me-order-item { border-bottom-color: rgba(255,255,255,0.05); }
    .m-me-stat { background: #0f172a; }
    .m-me-action { background: var(--m-card); color: var(--m-text); border-color: var(--m-border); }
    .m-me-action.primary { background: var(--m-primary); color: #fff; }
    .m-me-order-tag.invite { background: rgba(30, 64, 175, 0.25); color: #93c5fd; }
    .m-me-order-tag.renewal { background: rgba(6, 95, 70, 0.25); color: #6ee7b7; }
    .m-me-order-tag.register { background: rgba(91, 33, 182, 0.25); color: #c4b5fd; }
    .m-sms-btn { color: var(--m-primary); }
}
