/* ========================================================================
 * 云盘系统 · 移动版样式
 * 设计原则：原生感、单手可用、44px+ 触控目标、安全区适配
 * ======================================================================== */

/* ========== CSS 变量（亮/暗主题） ========== */
:root {
    --bg:        #f4f6fb;
    --bg-card:   #ffffff;
    --bg-elev:  #ffffff;
    --bg-hover:  #f1f5f9;
    --text:      #0f172a;
    --text-2:    #475569;
    --text-3:    #94a3b8;
    --border:    #e2e8f0;
    --border-2:  #cbd5e1;
    --primary:   #2563eb;
    --primary-2: #1d4ed8;
    --danger:    #dc2626;
    --warning:   #f59e0b;
    --success:   #10b981;
    --tabbar-bg: rgba(255,255,255,.96);
    --topbar-bg: #2563eb;
    --topbar-fg: #ffffff;
    --shadow-1:  0 1px 3px rgba(15,23,42,.06);
    --shadow-2:  0 4px 16px rgba(15,23,42,.10);
    --shadow-3:  0 10px 40px rgba(15,23,42,.18);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top:    env(safe-area-inset-top, 0px);
}
html[data-theme=dark] {
    --bg:        #0b1220;
    --bg-card:   #131c2f;
    --bg-elev:  #1a2440;
    --bg-hover:  #1e293b;
    --text:      #e2e8f0;
    --text-2:    #94a3b8;
    --text-3:    #64748b;
    --border:    #1e293b;
    --border-2:  #334155;
    --tabbar-bg: rgba(15,23,42,.96);
    --topbar-bg: #0f172a;
    --shadow-1:  0 1px 3px rgba(0,0,0,.4);
    --shadow-2:  0 4px 16px rgba(0,0,0,.4);
    --shadow-3:  0 10px 40px rgba(0,0,0,.6);
}

/* ========== 基础重置 ========== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    overscroll-behavior-y: contain;
    -webkit-font-smoothing: antialiased;
}
body {
    min-height: 100vh;
    padding-top: calc(52px + var(--safe-top));
    padding-bottom: calc(64px + var(--safe-bottom));
}
body.no-bottom { padding-bottom: var(--safe-bottom); }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; color: inherit; }
::selection { background: rgba(37,99,235,.25); }

/* ========== 顶部 App Bar ========== */
.m-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(52px + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--topbar-bg);
    color: var(--topbar-fg);
    display: flex; align-items: center;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.m-iconbtn {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    color: inherit;
    font-size: 22px;
    border-radius: 50%;
    flex-shrink: 0;
}
.m-iconbtn:active { background: rgba(255,255,255,.15); }
.m-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    margin: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.m-topbar-right {
    display: flex; align-items: center;
}
.m-hamburger {
    position: relative;
    display: block;
    width: 18px; height: 2px;
    background: currentColor;
    border-radius: 1px;
}
.m-hamburger::before, .m-hamburger::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}
.m-hamburger::before { top: -6px; }
.m-hamburger::after  { top:  6px; }

/* ========== 抽屉菜单 ========== */
.m-drawer-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
}
.m-drawer-mask.open { opacity: 1; pointer-events: auto; }
.m-drawer {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 80vw; max-width: 320px;
    background: var(--bg-card);
    z-index: 201;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.32,.72,0,1);
    display: flex; flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
}
.m-drawer.open { transform: translateX(0); }
.m-drawer-head {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    padding: calc(20px + var(--safe-top)) 20px 20px;
    display: flex; align-items: center; gap: 14px;
}
.m-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 500;
    flex-shrink: 0;
}
.m-uinfo { flex: 1; min-width: 0; }
.m-uname { font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.m-umail { font-size: 12px; opacity: .85; margin-top: 2px; word-break: break-all; }
.m-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    background: rgba(255,255,255,.25);
}
.m-tag.admin { background: #f59e0b; }
.m-drawer-nav {
    flex: 1; overflow-y: auto;
    padding: 8px 0;
}
.m-drawer-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px;
    color: var(--text);
    font-size: 15px;
}
.m-drawer-nav a .ic { font-size: 18px; width: 24px; text-align: center; }
.m-drawer-nav a:active { background: var(--bg-hover); }
.m-drawer-nav a.active { color: var(--primary); background: rgba(37,99,235,.08); font-weight: 500; }
.m-drawer-nav a.sub { padding-left: 44px; font-size: 14px; color: var(--text-2); }
.m-drawer-nav a.text-danger { color: var(--danger); }
.m-drawer-divider {
    height: 1px; background: var(--border);
    margin: 8px 16px;
}
.m-drawer-foot {
    padding: 12px 20px calc(12px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
}

/* ========== 主内容区 ========== */
.m-main {
    padding: 12px;
    min-height: calc(100vh - 52px - 64px - var(--safe-top) - var(--safe-bottom));
}

/* ========== 底部 Tab 导航 ========== */
.m-tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(56px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--tabbar-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 90;
}
.m-tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-3);
    font-size: 11px;
    gap: 2px;
    padding: 6px 0;
}
.m-tab .ic { font-size: 22px; line-height: 1; }
.m-tab.active { color: var(--primary); }
.m-tab:active { background: var(--bg-hover); }

/* ========== 通用按钮 ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: opacity .15s;
    min-height: 40px;
}
.btn:active { opacity: .7; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger);  }
.btn-sm { padding: 6px 10px; font-size: 13px; min-height: 32px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ========== 表单 ========== */
.form-row { margin-bottom: 14px; }
.form-row label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-2);
}
.form-row input[type=text],
.form-row input[type=password],
.form-row input[type=email],
.form-row input[type=number],
.form-row select,
.form-row textarea,
.m-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-2);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 16px; /* 防 iOS 缩放 */
    -webkit-appearance: none;
    appearance: none;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus,
.m-input:focus {
    outline: 2px solid rgba(37,99,235,.3);
    border-color: var(--primary);
}

/* ========== 配额条 ========== */
.m-quota {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-1);
}
.m-quota-text {
    display: flex; justify-content: space-between;
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 8px;
}
.m-quota-text strong { color: var(--text); font-weight: 500; }
.m-quota-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.m-quota-bar > div {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width .4s;
}
.m-quota-bar.warn > div { background: linear-gradient(90deg, #f59e0b, #ef4444); }

/* ========== 工具栏 ========== */
.m-toolbar {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px;
}
.m-toolbar .m-search {
    flex: 1;
    position: relative;
}
.m-toolbar .m-search input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 14px;
    -webkit-appearance: none;
    appearance: none;
}
.m-toolbar .m-search::before {
    content: '🔍';
    position: absolute;
    left: 11px; top: 50%; transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
}
.m-chips {
    display: flex; gap: 6px;
    overflow-x: auto;
    padding: 4px 0 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.m-chips::-webkit-scrollbar { display: none; }
.m-chip {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-2);
    font-size: 13px;
    white-space: nowrap;
}
.m-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ========== 面包屑 ========== */
.m-crumb {
    display: flex; align-items: center; gap: 4px;
    overflow-x: auto;
    padding: 6px 0;
    margin-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    color: var(--text-2);
    font-size: 13px;
}
.m-crumb::-webkit-scrollbar { display: none; }
.m-crumb a {
    color: var(--text-2);
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}
.m-crumb a:active { background: var(--bg-hover); }
.m-crumb a.cur { color: var(--text); font-weight: 500; }
.m-crumb .sep { color: var(--text-3); flex-shrink: 0; }

/* ========== 文件列表 ========== */
.m-list {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-1);
}
.m-list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    position: relative;
    -webkit-user-select: none;
    user-select: none;
    min-height: 56px;
}
.m-list-item:last-child { border-bottom: 0; }
.m-list-item:active { background: var(--bg-hover); }
.m-list-item.selected { background: rgba(37,99,235,.08); }
.m-list-item .m-thumb {
    width: 44px; height: 44px;
    border-radius: 8px;
    background: var(--bg-hover);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    overflow: hidden;
}
.m-list-item .m-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.m-list-item .m-meta {
    flex: 1; min-width: 0;
}
.m-list-item .m-name {
    font-size: 14px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}
.m-list-item .m-sub {
    font-size: 12px;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.m-list-item .m-sub .dot { margin: 0 6px; opacity: .5; }
.m-list-item .m-act {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-3);
    font-size: 22px;
    border-radius: 50%;
    flex-shrink: 0;
}
.m-list-item .m-act:active { background: var(--bg-hover); }
.m-list-item .m-chk {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-2);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: transparent;
    font-size: 14px;
    transition: all .15s;
}
.m-list-item.selected .m-chk {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ========== 图片网格视图 ========== */
.m-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    background: transparent;
}
.m-grid-item {
    aspect-ratio: 1 / 1;
    background: var(--bg-card);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    -webkit-user-select: none; user-select: none;
}
.m-grid-item img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.m-grid-item.selected::after {
    content: '✓';
    position: absolute; top: 6px; right: 6px;
    width: 22px; height: 22px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    box-shadow: 0 0 0 2px #fff;
}

/* ========== 浮动操作按钮 (FAB) ========== */
.m-fab {
    position: fixed;
    right: 16px;
    bottom: calc(76px + var(--safe-bottom));
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 26px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-2);
    z-index: 80;
}
.m-fab:active { transform: scale(.94); }
.m-fab.open { background: var(--danger); transform: rotate(45deg); }

/* FAB 菜单（弹出多个子按钮） */
.m-fab-menu {
    position: fixed;
    right: 16px;
    bottom: calc(140px + var(--safe-bottom));
    z-index: 79;
    display: flex; flex-direction: column; gap: 10px;
    align-items: flex-end;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .2s, transform .2s;
}
.m-fab-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.m-fab-menu .item {
    display: flex; align-items: center; gap: 10px;
}
.m-fab-menu .item .lbl {
    background: var(--bg-card);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    box-shadow: var(--shadow-1);
}
.m-fab-menu .item .ic {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-2);
}

/* ========== 选择/批量操作栏 ========== */
.m-selbar {
    position: fixed;
    left: 0; right: 0;
    top: calc(52px + var(--safe-top));
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    display: flex; align-items: center; gap: 8px;
    z-index: 95;
    box-shadow: var(--shadow-1);
}
.m-selbar .info {
    flex: 1; font-size: 14px; color: var(--text);
}
.m-selbar .info strong { color: var(--primary); }
.m-selbar button {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
}
.m-selbar button:active { background: var(--bg-hover); }

/* ========== 底部 Sheet（操作菜单） ========== */
.m-sheet-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 300;
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
}
.m-sheet-mask.open { opacity: 1; pointer-events: auto; }
.m-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--bg-card);
    border-radius: 16px 16px 0 0;
    z-index: 301;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.32,.72,0,1);
    max-height: 80vh;
    display: flex; flex-direction: column;
    padding-bottom: var(--safe-bottom);
}
.m-sheet.open { transform: translateY(0); }
.m-sheet-handle {
    width: 36px; height: 4px;
    background: var(--border-2);
    border-radius: 2px;
    margin: 8px auto 4px;
    flex-shrink: 0;
}
.m-sheet-title {
    padding: 8px 16px 12px;
    font-size: 13px;
    color: var(--text-3);
    text-align: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    word-break: break-all;
}
.m-sheet-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 0;
}
.m-sheet-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    color: var(--text);
    font-size: 15px;
}
.m-sheet-item:active { background: var(--bg-hover); }
.m-sheet-item .ic { font-size: 20px; width: 24px; text-align: center; }
.m-sheet-item.danger { color: var(--danger); }
.m-sheet-item.disabled { color: var(--text-3); pointer-events: none; }

/* ========== 模态对话框 ========== */
.m-modal-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 400;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.m-modal {
    width: 100%; max-width: 360px;
    background: var(--bg-card);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-3);
    animation: modalIn .2s;
    max-height: 85vh;
    display: flex; flex-direction: column;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.94); }
    to   { opacity: 1; transform: scale(1); }
}
.m-modal header {
    padding: 16px 20px 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}
.m-modal .body {
    padding: 0 20px 14px;
    overflow-y: auto;
    color: var(--text-2);
    font-size: 14px;
}
.m-modal .foot {
    display: flex;
    border-top: 1px solid var(--border);
}
.m-modal .foot button {
    flex: 1;
    padding: 14px;
    color: var(--text);
    font-size: 15px;
}
.m-modal .foot button + button { border-left: 1px solid var(--border); }
.m-modal .foot button.primary { color: var(--primary); font-weight: 500; }
.m-modal .foot button.danger  { color: var(--danger);  font-weight: 500; }

/* ========== Toast ========== */
#mToastBox {
    position: fixed;
    top: calc(70px + var(--safe-top));
    left: 50%; transform: translateX(-50%);
    z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
    width: max-content;
    max-width: 90vw;
}
.m-toast {
    background: rgba(15,23,42,.92);
    color: #fff;
    padding: 10px 16px;
    border-radius: 22px;
    font-size: 14px;
    box-shadow: var(--shadow-2);
    animation: toastIn .25s;
    max-width: 100%;
    word-break: break-all;
    text-align: center;
}
.m-toast.ok    { background: rgba(16,185,129,.95); }
.m-toast.error { background: rgba(220,38,38,.95); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== 上传进度 ========== */
.m-upload-bar {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(80px + var(--safe-bottom));
    background: var(--bg-card);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: var(--shadow-2);
    z-index: 85;
    transform: translateY(120%);
    transition: transform .3s;
    display: flex; align-items: center; gap: 10px;
}
.m-upload-bar.show { transform: translateY(0); }
.m-upload-bar .ic { font-size: 22px; }
.m-upload-bar .info {
    flex: 1; min-width: 0;
}
.m-upload-bar .lbl {
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.m-upload-bar .bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}
.m-upload-bar .bar > div {
    height: 100%;
    background: var(--primary);
    transition: width .2s;
}

/* ========== 空状态 ========== */
.m-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
}
.m-empty .ic { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.m-empty .txt { font-size: 14px; }

/* ========== 下拉刷新 ========== */
.m-pull {
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
    padding: 8px 0;
    height: 0;
    overflow: hidden;
    transition: height .15s;
}
.m-pull.show { height: 36px; }

/* ========== 卡片 / 设置项 ========== */
.m-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-1);
}
.m-card h3 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex; align-items: center; gap: 6px;
}
.m-setting-list {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: var(--shadow-1);
}
.m-setting-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    min-height: 50px;
}
.m-setting-item:last-child { border-bottom: 0; }
.m-setting-item:active { background: var(--bg-hover); }
.m-setting-item .ic { font-size: 20px; width: 24px; text-align: center; }
.m-setting-item .lbl { flex: 1; }
.m-setting-item .val { color: var(--text-3); font-size: 13px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-setting-item .arr { color: var(--text-3); font-size: 18px; }

/* ========== 提示 / Alert ========== */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info  { background: #dbeafe; color: #1e40af; }
.alert-ok    { background: #d1fae5; color: #065f46; }
html[data-theme=dark] .alert-error { background: rgba(220,38,38,.2); color: #fca5a5; }
html[data-theme=dark] .alert-info  { background: rgba(37,99,235,.2);  color: #93c5fd; }
html[data-theme=dark] .alert-ok    { background: rgba(16,185,129,.2); color: #6ee7b7; }

/* ========== 登录/注册页 ========== */
body.auth-page {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    padding: 0;
    min-height: 100vh;
    display: flex; flex-direction: column;
    justify-content: center;
}
body.auth-page .m-topbar,
body.auth-page .m-tabbar { display: none; }
.auth-wrap {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 24px;
}
.auth-logo {
    text-align: center;
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 28px;
    text-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.auth-card {
    background: var(--bg-card);
    color: var(--text);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: var(--shadow-3);
}
.auth-card h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
}
.auth-card .sub {
    color: var(--text-2);
    font-size: 13px;
    margin-bottom: 20px;
}
.auth-foot {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-2);
}

/* ========== 预览（Lightbox） ========== */
.m-lightbox {
    position: fixed; inset: 0;
    background: #000;
    z-index: 500;
    display: flex; flex-direction: column;
    color: #fff;
}
.m-lightbox-head {
    height: calc(48px + var(--safe-top));
    padding-top: var(--safe-top);
    display: flex; align-items: center;
    background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,0));
    position: relative;
    z-index: 2;
}
.m-lightbox-head .m-iconbtn { color: #fff; }
.m-lightbox-head .title {
    flex: 1;
    font-size: 14px;
    margin: 0 8px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #fff;
}
.m-lightbox-body {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    position: relative;
}
.m-lightbox-body img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    transition: transform .15s;
    -webkit-user-select: none; user-select: none;
    -webkit-user-drag: none;
}
.m-lightbox-body video,
.m-lightbox-body audio {
    max-width: 100%; max-height: 100%;
}
.m-lightbox-body iframe,
.m-lightbox-body .text-preview {
    width: 100%; height: 100%;
    background: #fff;
    color: #000;
    border: 0;
}
.m-lightbox-body .text-preview {
    overflow: auto;
    padding: 16px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
}
.m-lightbox-foot {
    height: calc(56px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: flex; align-items: center; justify-content: space-around;
    background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.7));
    position: relative;
    z-index: 2;
}
.m-lightbox-foot button {
    color: #fff;
    padding: 6px 14px;
    font-size: 13px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 60px;
}
.m-lightbox-foot button .ic { font-size: 22px; }

/* ========== 文件夹选择器 ========== */
.m-tree {
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.m-tree-item {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
}
.m-tree-item:active { background: var(--bg-hover); }
.m-tree-item.selected { background: rgba(37,99,235,.1); color: var(--primary); }
.m-tree-item .ic { width: 20px; text-align: center; flex-shrink: 0; }

/* ========== 标签 ========== */
.m-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: var(--bg-hover);
    color: var(--text-2);
    margin-left: 4px;
}
.m-pill.ok   { background: rgba(16,185,129,.15);  color: #047857; }
.m-pill.no   { background: rgba(220,38,38,.15);   color: #b91c1c; }
.m-pill.warn { background: rgba(245,158,11,.15);  color: #b45309; }
html[data-theme=dark] .m-pill.ok   { color: #6ee7b7; }
html[data-theme=dark] .m-pill.no   { color: #fca5a5; }
html[data-theme=dark] .m-pill.warn { color: #fcd34d; }

/* ========== 实用类 ========== */
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hide { display: none !important; }

/* ========== 不可滚动锁定 ========== */
body.no-scroll { overflow: hidden; touch-action: none; }
