/* ============================================================
   File Server - Shared Stylesheet
   Refined minimalism palette, mobile-first, system dark mode.
   ============================================================ */

:root {
    --bg: #fafaf9;
    --surface: #ffffff;
    --surface-2: #f5f5f4;
    --border: #e7e5e4;
    --border-strong: #d6d3d1;
    --text: #1c1917;
    --text-2: #57534e;
    --text-3: #a8a29e;
    --accent: #0f766e;
    --accent-soft: #ccfbf1;
    --accent-hover: #115e59;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --warn: #b45309;
    --warn-soft: #fef3c7;
    --ok: #15803d;
    --ok-soft: #dcfce7;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --radius: 10px;
    --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ 顶栏 ============ */
.navbar {
    background: rgba(255, 255, 255, .85);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    padding-top: max(14px, env(safe-area-inset-top));
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
}

.navbar h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar h1::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 2px;
}

.navbar-actions { display: flex; gap: 4px; align-items: center; }

.navbar-actions a, .navbar-actions .nav-btn {
    color: var(--text-2);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: inherit;
}

.navbar-actions a:hover, .navbar-actions .nav-btn:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.navbar-actions .role-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-weight: 500;
    margin-right: 4px;
}

/* ============ 容器 ============ */
.container { max-width: 960px; margin: 0 auto; padding: 20px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.card-title-left { display: flex; align-items: center; gap: 8px; }

.card-title .count {
    font-size: 11px;
    background: var(--surface-2);
    color: var(--text-2);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

/* ============ 面包屑 ============ */
.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--text-3);
}

.crumbs a, .crumbs .crumb-here {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-2);
    font-weight: 500;
    transition: background .15s;
}

.crumbs a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.crumbs .crumb-here { color: var(--text); background: var(--surface-2); }
.crumbs .sep { color: var(--text-3); user-select: none; }

/* ============ 上传区 ============ */
.upload-zone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--surface-2);
}

.upload-zone:hover, .upload-zone.drag {
    border-color: var(--accent);
    background: #f0fdfa;
}

.upload-zone-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 50%;
    border: 1px solid var(--border);
}

.upload-zone-icon svg { width: 20px; height: 20px; stroke: var(--accent); }
.upload-zone-text { font-size: 14px; font-weight: 500; color: var(--text); }
.upload-zone-hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }

.file-input { display: none; }

/* ============ 上传队列 ============ */
.queue { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }

.queue-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.queue-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.queue-item-name {
    font-weight: 500;
    color: var(--text);
    word-break: break-all;
    flex: 1;
    min-width: 0;
    font-size: 13px;
}

.queue-item-size { color: var(--text-3); font-size: 12px; flex-shrink: 0; }

.queue-item-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

.status-wait { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.status-ing { background: var(--accent-soft); color: var(--accent-hover); }
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-err { background: var(--danger-soft); color: var(--danger); }
.status-cancel { background: var(--surface); color: var(--text-3); border: 1px solid var(--border); }

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width .25s ease;
}

.progress-fill.err { background: var(--danger); }
.progress-fill.ok { background: var(--ok); }

.queue-item-detail { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* ============ 按钮 ============ */
.btn-row { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: var(--surface);
    color: var(--text);
    transition: all .15s;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.btn:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }

.btn svg { width: 14px; height: 14px; }

/* ============ 文件列表 ============ */
.file-list { display: flex; flex-direction: column; }

.file-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.file-item:first-child { padding-top: 4px; }
.file-item:last-child { border-bottom: none; padding-bottom: 4px; }

/* 文件夹行:整行可点击 */
.file-item.is-folder {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    /* 让整行用一个负向的内边距来扩大点击区,看起来无变化 */
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
    border-radius: var(--radius-sm);
    transition: background .12s;
}
.file-item.is-folder:hover {
    background: var(--surface-2);
    text-decoration: none;
}
.file-item.is-folder:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    background: var(--surface-2);
}
.file-item.is-folder .file-name a {
    pointer-events: none; /* 行级点击已统一处理,内层 a 不再单独响应 */
}

.file-icon {
    width: 36px;
    height: 36px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-2);
}

.file-icon.folder { color: var(--accent); background: var(--accent-soft); }
.file-icon svg { width: 18px; height: 18px; }

.file-info { flex: 1; min-width: 0; }

.file-name {
    font-weight: 500;
    color: var(--text);
    word-break: break-all;
    font-size: 14px;
    line-height: 1.4;
}

.file-name a { color: var(--text); }
.file-name a:hover { color: var(--accent); text-decoration: none; }

.file-meta {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 3px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.file-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.file-actions input {
    padding: 7px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    width: 120px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    min-height: 34px;
}

.file-actions input:focus { outline: none; border-color: var(--accent); }

.file-actions button {
    padding: 7px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    min-height: 34px;
    transition: all .15s;
    font-family: inherit;
}

.file-actions button:hover { background: var(--surface-2); color: var(--text); }

.btn-set { color: var(--accent) !important; border-color: var(--accent-soft) !important; }
.btn-set:hover { background: var(--accent-soft) !important; }
.btn-copy { color: var(--ok) !important; border-color: var(--ok-soft) !important; }
.btn-copy:hover { background: var(--ok-soft) !important; }
.btn-del { color: var(--danger) !important; border-color: var(--danger-soft) !important; }
.btn-del:hover { background: var(--danger-soft) !important; }

.btn-download {
    color: var(--accent) !important;
    border-color: var(--accent-soft) !important;
    background: var(--accent-soft) !important;
}

.btn-download:hover { background: var(--accent) !important; color: white !important; }

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-lock { background: var(--ok-soft); color: var(--ok); }
.badge-unlock { background: var(--warn-soft); color: var(--warn); }

/* ============ Toast ============ */
.toast {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    color: white;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
    font-size: 13px;
    font-weight: 500;
    transition: transform .25s ease;
    max-width: calc(100vw - 32px);
    text-align: center;
}

.toast.show { transform: translateX(-50%) translateY(0); }

.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-3);
    font-size: 13px;
}

.empty svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    opacity: .4;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ============ 登录/单页表单(共用) ============ */
.center-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg);
}

.center-box {
    background: var(--surface);
    padding: 36px 28px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.center-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 12px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.center-icon svg { width: 24px; height: 24px; }

.center-icon.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.center-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.center-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 20px;
    word-break: break-all;
}

.form-group { margin-bottom: 14px; }

.form-label {
    display: block;
    color: var(--text-2);
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    background: var(--surface);
    min-height: 44px;
    -webkit-appearance: none;
    color: var(--text);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.center-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    margin-top: 4px;
    transition: background .15s;
    font-family: inherit;
}

.center-btn:hover { background: var(--accent-hover); }
.center-btn:disabled { opacity: .5; cursor: not-allowed; }

.center-hint { text-align: center; margin-top: 14px; color: var(--text-3); font-size: 12px; }
.center-hint a { color: var(--accent); text-decoration: none; }

.alert {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    text-align: center;
    font-size: 13px;
}

.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

/* ============ Modal ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--surface);
    padding: 22px;
    border-radius: var(--radius);
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.modal-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text); }

.modal-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--surface-2);
    min-height: 42px;
    color: var(--text);
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.modal-btn {
    padding: 9px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    min-height: 38px;
    font-family: inherit;
}

.modal-btn-secondary {
    background: var(--surface);
    color: var(--text-2);
    border: 1px solid var(--border);
}

/* ============================================================
   API 文档:左侧菜单 + 右侧详情
   ============================================================ */
.api-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 0;
    min-height: calc(100vh - 56px);
}

/* ----- 左侧菜单 ----- */
.api-sidebar {
    border-right: 1px solid var(--border);
    background: var(--surface);
    height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
    overflow-y: auto;
}

.api-sidebar-inner {
    padding: 16px 12px 32px;
}

.api-sidebar-section {
    margin-bottom: 18px;
}

.api-sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 6px 12px;
    margin-bottom: 4px;
}

.api-sidebar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    line-height: 1.3;
    transition: background .15s, color .15s;
    word-break: break-all;
}

.api-sidebar-link:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.api-sidebar-link.active {
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-weight: 500;
}

/* 菜单内 method 标签 */
.api-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: .04em;
    min-width: 36px;
    text-align: center;
}

.api-tag.get { background: var(--accent-soft); color: var(--accent-hover); }
.api-tag.post { background: var(--ok-soft); color: var(--ok); }

/* ----- 右侧详情 ----- */
.api-content {
    padding: 28px 32px 60px;
    max-width: 880px;
    min-width: 0;
}

.api-section {
    scroll-margin-top: 72px; /* 顶部 sticky navbar 让出空间 */
    margin-bottom: 28px;
}

.api-h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
    letter-spacing: -.01em;
}

.api-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow-sm);
}

.api-card p {
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.7;
}

.api-card p + p { margin-top: 8px; }

/* 端点卡片 */
.api-endpoint-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.api-endpoint-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.api-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    min-width: 50px;
}

.api-method.get { background: var(--accent-soft); color: var(--accent-hover); }
.api-method.post { background: var(--ok-soft); color: var(--ok); }

.api-path {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
    word-break: break-all;
    flex: 1;
    min-width: 0;
}

.api-tag-side {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-weight: 500;
    flex-shrink: 0;
}

.api-block {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.api-block:last-child { border-bottom: none; }

.api-block-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 8px;
}

.api-block p {
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.7;
    margin: 0;
}

.api-block table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.api-block th, .api-block td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.api-block tr:last-child td { border-bottom: none; }

.api-block th {
    color: var(--text-3);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--surface-2);
}

.api-block code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: 3px;
    color: var(--text);
}

.api-block pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--text);
    overflow-x: auto;
    line-height: 1.6;
    margin: 0;
}

.req-yes {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 11px;
    font-weight: 600;
}

.req-no {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 11px;
    font-weight: 500;
}

/* ----- 移动端遮罩与切换按钮 ----- */
.api-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, .4);
    z-index: 90;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.api-sidebar-overlay.show { display: block; }

.api-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(15, 118, 110, .35);
    cursor: pointer;
    z-index: 80;
    align-items: center;
    justify-content: center;
}

.api-sidebar-toggle svg { width: 22px; height: 22px; }

/* 移动端:菜单变成抽屉 */
@media (max-width: 768px) {
    .api-layout { grid-template-columns: 1fr; }

    .api-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        width: 280px;
        max-width: 80vw;
        z-index: 95;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, .15);
    }

    .api-sidebar.open { transform: translateX(0); }

    .api-content { padding: 20px 16px 80px; }

    .api-sidebar-toggle { display: inline-flex; }

    .api-endpoint-header { padding: 12px 16px; }
    .api-block { padding: 12px 16px; }
    .api-path { font-size: 13px; }
}

/* ============ 移动端适配 ============ */
@media (max-width: 640px) {
    body { font-size: 14px; }

    .navbar { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
    .navbar h1 { font-size: 15px; }
    .navbar-actions a, .navbar-actions .nav-btn { padding: 6px 10px; font-size: 12px; }

    .container { padding: 14px; }
    .card { padding: 16px; border-radius: 8px; }

    .upload-zone { padding: 24px 14px; }
    .upload-zone-icon { width: 36px; height: 36px; }
    .upload-zone-text { font-size: 13px; }

    .file-item { flex-wrap: wrap; gap: 10px; padding: 12px 0; }
    .file-info { flex: 1 1 calc(100% - 48px); }
    .file-actions {
        flex: 1 1 100%;
        gap: 6px;
        margin-top: 4px;
    }
    .file-actions input {
        flex: 1 1 100%;
        width: 100%;
        min-height: 40px;
        font-size: 14px;
    }
    .file-actions button {
        flex: 1 1 0;
        min-width: 0;
        min-height: 40px;
        font-size: 13px;
    }

    .btn-row .btn { flex: 1 1 0; }
    .queue-item-name { font-size: 13px; }
    .queue-item-size { font-size: 11px; }

    .crumbs { font-size: 12px; }
    .crumbs a, .crumbs .crumb-here { padding: 4px 6px; }
}

/* ============ 暗色模式 ============ */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0c0a09;
        --surface: #1c1917;
        --surface-2: #292524;
        --border: #292524;
        --border-strong: #44403c;
        --text: #fafaf9;
        --text-2: #a8a29e;
        --text-3: #78716c;
        --accent: #2dd4bf;
        --accent-soft: #134e4a;
        --accent-hover: #5eead4;
        --danger: #f87171;
        --danger-soft: #450a0a;
        --warn: #fbbf24;
        --warn-soft: #451a03;
        --ok: #4ade80;
        --ok-soft: #052e16;
    }

    .navbar { background: rgba(28, 25, 23, .85); }
    .upload-zone:hover, .upload-zone.drag { background: #134e4a40; }
}