/* =============================================================================
   云文件共享平台 SaaS v9.0 · 设计系统
   ---------------------------------------------------------------------------
   纯 CSS，无外部依赖（适配内网/离线部署）
   ============================================================================= */

:root {
    /* 品牌色（由平台/租户品牌设置动态覆盖） */
    --brand: #2563eb;
    --brand-2: #1e40af;
    --brand-soft: #eef4ff;

    /* 中性色 */
    --bg: #f4f6fb;
    --panel: #ffffff;
    --panel-2: #fafbfe;
    --line: #e6eaf2;
    --line-strong: #d3dae7;

    --text: #1f2937;
    --text-2: #4b5563;
    --muted: #8a94a6;

    /* 语义色 */
    --ok: #16a34a;
    --ok-soft: #e9f8ee;
    --warn: #d97706;
    --warn-soft: #fef4e6;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --info: #0891b2;
    --info-soft: #e6f7fb;

    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 16px;

    --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-2: 0 4px 16px rgba(16, 24, 40, .08);
    --shadow-3: 0 18px 48px rgba(16, 24, 40, .16);

    --sidebar-w: 232px;
    --header-h: 60px;

    --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 600; line-height: 1.35; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

p { margin: 0 0 10px; }

code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ------------------------------------------------------------------ 布局 */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: #101828;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 60;
    transition: transform .22s ease;
}

.sidebar__brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex: 0 0 auto;
}
.sidebar__logo {
    width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px; flex: 0 0 auto;
}
.sidebar__name { font-size: 14.5px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__name small { display: block; font-size: 10.5px; color: #7c8798; font-weight: 400; letter-spacing: .3px; }

.sidebar__scroll { flex: 1 1 auto; overflow-y: auto; padding: 10px 8px 20px; }
.sidebar__scroll::-webkit-scrollbar { width: 6px; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }

.nav-group { margin-bottom: 6px; }
.nav-group__title {
    font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase;
    color: #64748b; padding: 12px 12px 6px; font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8.5px 12px; border-radius: var(--radius-sm);
    color: #cbd5e1; font-size: 13.5px; cursor: pointer;
    transition: background .15s, color .15s;
    user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--brand); color: #fff; font-weight: 500; }
.nav-item__icon { width: 18px; text-align: center; font-size: 15px; flex: 0 0 auto; }
.nav-item__badge {
    margin-left: auto; background: #ef4444; color: #fff;
    font-size: 10.5px; padding: 1px 6px; border-radius: 20px; font-weight: 600;
}

.sidebar__foot {
    flex: 0 0 auto; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.07);
    font-size: 11.5px; color: #64748b;
}

.main {
    margin-left: var(--sidebar-w);
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--header-h);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 50;
}
.topbar__toggle { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--text-2); }
.topbar__title { font-size: 16px; font-weight: 600; }
.topbar__crumb { color: var(--muted); font-size: 12.5px; }
.topbar__spacer { flex: 1 1 auto; }

.content { padding: 20px; flex: 1 1 auto; }

/* ------------------------------------------------------------------ 卡片 */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    margin-bottom: 16px;
}
.card__head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px;
}
.card__head h3 { margin: 0; font-size: 15px; }
.card__head .sub { color: var(--muted); font-size: 12px; }
.card__body { padding: 18px; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid--side { grid-template-columns: minmax(0, 1fr) 340px; }

/* 统计卡 */
.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-1);
    position: relative;
    overflow: hidden;
}
.stat__label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat__value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat__value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat__foot { margin-top: 8px; font-size: 12px; color: var(--muted); }
.stat__icon {
    position: absolute; right: 14px; top: 14px;
    width: 36px; height: 36px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; background: var(--brand-soft); color: var(--brand);
}
.stat--ok .stat__icon { background: var(--ok-soft); color: var(--ok); }
.stat--warn .stat__icon { background: var(--warn-soft); color: var(--warn); }
.stat--danger .stat__icon { background: var(--danger-soft); color: var(--danger); }
.stat__bar { height: 5px; background: var(--line); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.stat__bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .4s; }

/* ------------------------------------------------------------------ 按钮 */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border: 1px solid var(--line-strong);
    background: var(--panel);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit;
    cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
    user-select: none;
}
.btn:hover { background: var(--panel-2); border-color: var(--muted); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(.92); }
.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn--ok:hover { filter: brightness(.92); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--panel-2); border-color: var(--line); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn--lg { height: 42px; padding: 0 22px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--link { border: 0; background: none; padding: 0 4px; height: auto; color: var(--brand); }
.btn--link:hover { background: none; text-decoration: underline; }

/* ------------------------------------------------------------------ 表单 */

.field { margin-bottom: 14px; }
.field > label, .form-label {
    display: block; font-size: 12.5px; font-weight: 500;
    color: var(--text-2); margin-bottom: 5px;
}
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.field .req { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
    width: 100%;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 88px; padding: 9px 11px; line-height: 1.6; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a94a6' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--panel-2); color: var(--muted); cursor: not-allowed; }
.input--sm { height: 30px; font-size: 12.5px; }

.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline > .field { margin-bottom: 0; }
.search-box { position: relative; }
.search-box .input { padding-left: 32px; }
/* 放大镜图标用 SVG 遮罩绘制：不依赖 emoji 字体，任何环境都不会显示成方块 */
.search-box::before {
    content: ""; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 13px; height: 13px; opacity: .55; pointer-events: none;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M16 16l5 5'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M16 16l5 5'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; margin: 0; }

/* ------------------------------------------------------------------ 开关

   结构：<label class="switch">
           <input type="checkbox">
           <span class="switch__track"></span>
           <span class="switch__label">文字说明</span>
           <span class="switch__state"><span class="on">已开启</span><span class="off">已关闭</span></span>
         </label>

   两个必须守住的点：
   1) .switch 必须保持 inline-flex。轨道是 flex item 才能吃到宽高；
      一旦被 `.field > label { display:block }` 覆盖，`.switch__track` 会退化成
      行内元素，宽高失效、白色滑块（::after 绝对定位）直接叠在文字上 ——
      这正是反馈的「开关按钮和文字重叠」。
   2) 状态文案用两个 span 靠 CSS 切换，不写 JS：`input:checked ~ .switch__state`
      就能拿到选中态，比在每处 onChange 里改文字可靠得多。
*/
.switch {
    position: relative; display: inline-flex; align-items: center;
    gap: 8px; cursor: pointer; user-select: none;
    font-size: 13px; line-height: 1.2; vertical-align: middle;
}
/* 表单里开关经常直接放进 .field，这里用更高优先级把自己掰回 flex 布局 */
.field > label.switch, .field > .switch { display: inline-flex; margin-bottom: 0; font-weight: 400; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.switch__track {
    display: inline-block; flex: 0 0 auto;
    width: 40px; height: 22px; border-radius: 22px;
    background: #c3ccda; position: relative;
    transition: background .18s;
}
.switch__track::after {
    content: ""; position: absolute; left: 2px; top: 2px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s;
}
.switch input:checked + .switch__track { background: var(--ok); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.switch input:disabled + .switch__track { opacity: .45; }
.switch__label { color: var(--text-2); }
.switch input:checked ~ .switch__label { color: var(--text); }
.switch__state {
    font-size: 11px; line-height: 1.6; padding: 0 7px; border-radius: 999px;
    background: #eef1f6; color: var(--muted); white-space: nowrap;
    transition: background .18s, color .18s;
}
.switch input:checked ~ .switch__state { background: var(--ok-soft); color: #15803d; }
.switch__state .on { display: none; }
.switch__state .off { display: inline; }
.switch input:checked ~ .switch__state .on { display: inline; }
.switch input:checked ~ .switch__state .off { display: none; }
/* 小号：表格行、抽屉里用 */
.switch--sm { gap: 6px; font-size: 12.5px; }
.switch--sm .switch__track { width: 34px; height: 19px; }
.switch--sm .switch__track::after { width: 15px; height: 15px; }
.switch--sm input:checked + .switch__track::after { transform: translateX(15px); }
.switch--sm .switch__state { font-size: 10.5px; padding: 0 6px; }

.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card {
    flex: 1 1 140px; border: 1.5px solid var(--line-strong); border-radius: var(--radius);
    padding: 11px 13px; cursor: pointer; transition: all .15s; background: var(--panel);
}
.radio-card:hover { border-color: var(--brand); }
.radio-card.is-on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.radio-card input { display: none; }
.radio-card strong { display: block; font-size: 13.5px; }
.radio-card span { font-size: 11.5px; color: var(--muted); }

/* 分段控件 */
.segmented { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px; }
.segmented button {
    border: 0; background: none; padding: 5px 13px; font-size: 12.5px;
    border-radius: 5px; cursor: pointer; color: var(--text-2); font-family: inherit;
}
.segmented button.is-on { background: var(--panel); color: var(--brand); font-weight: 600; box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ 表格 */

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
    text-align: left; font-weight: 600; color: var(--text-2);
    background: var(--panel-2); padding: 10px 12px;
    border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr:hover { background: #f8fafd; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .actions { white-space: nowrap; text-align: right; }
table.tbl .actions .btn { margin-left: 4px; }
.tbl-empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.tbl-empty .ico { font-size: 0; display: flex; justify-content: center; margin-bottom: 8px; opacity: .5; }

.cell-main { font-weight: 500; }
.cell-sub { font-size: 11.5px; color: var(--muted); }

/* 批量选择条 */
.bulkbar {
    display: flex; align-items: center; gap: 12px;
    background: var(--brand-soft); border: 1px solid #cddcff;
    border-radius: var(--radius-sm); padding: 8px 14px; margin-bottom: 12px; font-size: 13px;
}

/* ------------------------------------------------------------------ 徽标 */

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 20px;
    font-size: 11.5px; font-weight: 500; line-height: 1.7;
    background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line);
    white-space: nowrap;
}
.badge--ok { background: var(--ok-soft); color: #15803d; border-color: #bfe8cd; }
.badge--warn { background: var(--warn-soft); color: #b45309; border-color: #f8ddb4; }
.badge--danger { background: var(--danger-soft); color: #b91c1c; border-color: #f6c9c9; }
.badge--info { background: var(--info-soft); color: #0e7490; border-color: #b6e6f2; }
.badge--brand { background: var(--brand-soft); color: var(--brand); border-color: #cddcff; }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------ 提示 */

.alert {
    padding: 11px 14px; border-radius: var(--radius-sm);
    font-size: 13px; margin-bottom: 14px; border: 1px solid transparent;
    display: flex; gap: 8px; align-items: flex-start;
}
.alert--info { background: var(--info-soft); border-color: #b6e6f2; color: #0e7490; }
.alert--warn { background: var(--warn-soft); border-color: #f8ddb4; color: #b45309; }
.alert--danger { background: var(--danger-soft); border-color: #f6c9c9; color: #b91c1c; }
.alert--ok { background: var(--ok-soft); border-color: #bfe8cd; color: #15803d; }

/* ------------------------------------------------------------------ Toast */

.toast-host {
    position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
    z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none;
}
.toast {
    background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px;
    font-size: 13.5px; box-shadow: var(--shadow-3); max-width: 460px;
    animation: toastIn .22s ease; display: flex; gap: 8px; align-items: center;
}
.toast--ok { background: #15803d; }
.toast--err { background: #b91c1c; }
.toast--warn { background: #b45309; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ 模态 */

.modal-mask {
    position: fixed; inset: 0; background: rgba(16, 24, 40, .48);
    z-index: 9000; display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--panel); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-3); width: 100%; max-width: 560px;
    max-height: 88vh; display: flex; flex-direction: column;
    animation: modalIn .2s cubic-bezier(.2,.9,.3,1.2);
}
.modal--lg { max-width: 820px; }
.modal--xl { max-width: 1080px; }
.modal--sm { max-width: 420px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head {
    padding: 16px 20px; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
}
.modal__head h3 { margin: 0; font-size: 16px; }
.modal__close {
    margin-left: auto; border: 0; background: none; font-size: 20px;
    color: var(--muted); cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.modal__close:hover { background: var(--panel-2); color: var(--text); }
.modal__body { padding: 20px; overflow-y: auto; flex: 1 1 auto; }
.modal__foot {
    padding: 13px 20px; border-top: 1px solid var(--line);
    display: flex; gap: 10px; justify-content: flex-end; flex: 0 0 auto;
}

/* 抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(16,24,40,.42); z-index: 8900; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 94vw;
    background: var(--panel); z-index: 8950; box-shadow: var(--shadow-3);
    display: flex; flex-direction: column; animation: drawerIn .22s ease;
}
@keyframes drawerIn { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ 分页 */

.pager { display: flex; align-items: center; gap: 6px; padding: 14px 4px 4px; flex-wrap: wrap; }
.pager__info { font-size: 12.5px; color: var(--muted); margin-right: auto; }
.pager button {
    min-width: 32px; height: 32px; padding: 0 9px;
    border: 1px solid var(--line-strong); background: var(--panel);
    border-radius: 6px; cursor: pointer; font-size: 13px;
    color: var(--text-2); font-family: inherit;
}
.pager button:hover:not([disabled]) { border-color: var(--brand); color: var(--brand); }
.pager button.is-on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager button[disabled] { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------------ 标签页 */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
    border: 0; background: none; padding: 10px 16px; font-size: 13.5px;
    color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent;
    font-family: inherit; white-space: nowrap;
}
.tabs button:hover { color: var(--brand); }
.tabs button.is-on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ------------------------------------------------------------------ 空态 */

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ico { font-size: 0; display: flex; justify-content: center; margin-bottom: 12px; opacity: .45; }
.empty h4 { color: var(--text-2); margin-bottom: 4px; }

/* ------------------------------------------------------------------ 骨架屏 */

.skeleton {
    background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%);
    background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
    border-radius: 6px; height: 14px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ------------------------------------------------------------------ 图表（内置 SVG 渲染） */

.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart__legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.chart__legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.chart-tip {
    position: fixed; z-index: 9500; background: #1f2937; color: #fff;
    padding: 5px 10px; border-radius: 6px; font-size: 12px; pointer-events: none;
    box-shadow: var(--shadow-2); white-space: nowrap; display: none;
}

/* ------------------------------------------------------------------ 进度条 */

.progress { height: 8px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 5px; transition: width .3s; }
.progress--ok i { background: var(--ok); }
.progress--warn i { background: var(--warn); }
.progress--danger i { background: var(--danger); }

/* ------------------------------------------------------------------ 文件列表 */

.filelist { display: flex; flex-direction: column; }
.filerow {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-bottom: 1px solid var(--line);
    transition: background .12s;
}
.filerow:hover { background: #f8fafd; }
.filerow.is-dir { cursor: pointer; }
.filerow__ico {
    width: 34px; height: 34px; border-radius: 8px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; font-size: 17px;
    background: var(--brand-soft);
}
.filerow__name { flex: 1 1 auto; min-width: 0; }
.filerow__name strong { display: block; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filerow__name span { font-size: 11.5px; color: var(--muted); }
.filerow__actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.filerow:hover .filerow__actions,
.filerow:focus-within .filerow__actions { opacity: 1; }
/* 触屏设备没有 hover：若仍隐藏，手机/平板上预览、分享、收藏、更多这些按钮
   会完全不可见也无法点到。故在无 hover 能力或窄屏下始终显示。 */
@media (hover: none) {
    .filerow__actions { opacity: 1; }
}
@media (max-width: 720px) {
    .filerow__actions { opacity: 1; }
    .filerow { gap: 8px; padding: 10px; }
    .filerow__name span { display: none; }
}

/* 拖拽上传 */
.dropzone {
    border: 2px dashed var(--line-strong); border-radius: var(--radius);
    padding: 34px 20px; text-align: center; color: var(--muted);
    transition: all .18s; cursor: pointer; background: var(--panel-2);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dropzone .ico { font-size: 0; display: flex; justify-content: center; margin-bottom: 8px; }

/* 上传队列 */
.uplist { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.upitem { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.upitem__head { display: flex; gap: 10px; font-size: 12.5px; margin-bottom: 6px; align-items: center; }
.upitem__head strong { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* ------------------------------------------------------------------ 登录/公开页 */

.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 30px 18px;
    background:
        radial-gradient(1000px 500px at 12% -8%, rgba(37,99,235,.13), transparent 60%),
        radial-gradient(900px 460px at 92% 108%, rgba(30,64,175,.13), transparent 60%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 420px; background: var(--panel);
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2); padding: 30px 30px 26px;
}
.auth-card--wide { max-width: 720px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .logo {
    width: 50px; height: 50px; border-radius: 14px; margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 22px; font-weight: 700;
    box-shadow: 0 8px 22px rgba(37, 99, 235, .3);
}
.auth-brand h1 { font-size: 20px; margin-bottom: 4px; }
.auth-brand p { color: var(--muted); font-size: 13px; margin: 0; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--muted); }

.public-header {
    height: 60px; background: var(--panel); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px; padding: 0 22px;
    position: sticky; top: 0; z-index: 40;
}
.public-header .logo {
    width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px;
}
.public-header .name { font-weight: 600; font-size: 15px; }
.public-header .spacer { flex: 1 1 auto; }
.public-body { max-width: 1080px; margin: 0 auto; padding: 24px 18px 60px; }

/* Hero */
.hero { padding: 70px 18px 60px; text-align: center; }
.hero h1 { font-size: 38px; letter-spacing: -1px; margin-bottom: 14px; line-height: 1.25; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { font-size: 16px; color: var(--text-2); max-width: 640px; margin: 0 auto 26px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feature {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow-1);
}
.feature .ico {
    width: 40px; height: 40px; border-radius: 11px; background: var(--brand-soft);
    color: var(--brand); display: flex; align-items: center; justify-content: center;
    font-size: 0; margin-bottom: 12px;
}
.feature h4 { font-size: 15px; margin-bottom: 6px; }
.feature p { font-size: 13px; color: var(--muted); margin: 0; }

/* 套餐卡 */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 16px; }
.plan {
    background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius-lg);
    padding: 22px 20px; position: relative; transition: all .18s;
}
.plan:hover { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.plan.is-recommend { border-color: var(--brand); }
.plan__tag {
    position: absolute; top: -11px; right: 16px; background: var(--brand); color: #fff;
    font-size: 11px; padding: 2px 10px; border-radius: 20px; font-weight: 600;
}
.plan__name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.plan__desc { font-size: 12.5px; color: var(--muted); min-height: 36px; }
.plan__price { font-size: 30px; font-weight: 700; color: var(--brand); margin: 12px 0 2px; letter-spacing: -1px; }
.plan__price small { font-size: 13px; font-weight: 400; color: var(--muted); }
.plan__feat { list-style: none; padding: 0; margin: 16px 0 0; font-size: 13px; }
.plan__feat li { padding: 5px 0; color: var(--text-2); display: flex; gap: 8px; }
/* 对勾同样用 SVG 遮罩，避免依赖符号字体的 U+2713 覆盖率 */
.plan__feat li::before {
    content: ""; flex: 0 0 auto; width: 13px; height: 13px; margin-top: 4px;
    background-color: var(--ok);
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5 9 17.5 20 6.5'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5 9 17.5 20 6.5'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}
.plan__feat li.off { color: var(--muted); }
.plan__feat li.off::before { content: "—"; color: var(--muted); }

/* 取密页 */
.gate-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 30px 18px;
    background:
        radial-gradient(900px 460px at 50% -10%, rgba(37,99,235,.14), transparent 60%),
        var(--bg);
}
.gate-card {
    width: 100%; max-width: 440px; background: var(--panel);
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2); overflow: hidden;
}
.gate-card__head { padding: 26px 26px 18px; text-align: center; }
.gate-card__head .ico {
    width: 54px; height: 54px; border-radius: 15px; margin: 0 auto 12px;
    background: var(--brand-soft); color: var(--brand);
    display: flex; align-items: center; justify-content: center; font-size: 0;
}
.gate-card__head h2 { font-size: 18px; margin-bottom: 6px; word-break: break-all; }
.gate-card__head p { color: var(--muted); font-size: 12.5px; margin: 0; }
.gate-card__body { padding: 0 26px 24px; }
.gate-meta {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
    padding: 12px 26px; background: var(--panel-2); border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
.code-input {
    letter-spacing: 10px; text-align: center; font-size: 22px; font-weight: 600;
    height: 52px; font-family: var(--mono);
}

/* 预览区 */
.preview-stage {
    background: #0f172a; border-radius: var(--radius); padding: 18px;
    display: flex; align-items: center; justify-content: center; min-height: 380px;
    position: relative; overflow: auto;
}
.preview-stage img { max-width: 100%; max-height: 70vh; border-radius: 6px; }
.preview-stage video, .preview-stage audio { max-width: 100%; border-radius: 6px; }
.preview-stage pre {
    color: #e2e8f0; margin: 0; white-space: pre-wrap; word-break: break-all;
    font-size: 12.5px; line-height: 1.75; width: 100%;
}
.preview-stage iframe { width: 100%; height: 70vh; border: 0; border-radius: 6px; background: #fff; }

/* 分享页顶部公告（文字 + 可选超链接，后台可配置） */
.share-notice {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: var(--brand-soft); border: 1px solid rgba(37,99,235,.22);
    color: var(--brand); border-radius: 10px; padding: 10px 14px;
    font-size: 13px; line-height: 1.6;
}
.share-notice .ico, .share-notice .go { display: flex; align-items: center; }
.share-notice a { color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* 水印层（防截图外泄） */
.watermark-layer {
    position: fixed; inset: 0; pointer-events: none; z-index: 8000; overflow: hidden;
}
.watermark-layer span {
    position: absolute; color: rgba(120, 130, 150, .17);
    font-size: 14px; white-space: nowrap; transform: rotate(-28deg);
    user-select: none; font-weight: 500;
}

/* ------------------------------------------------------------------ 工具类 */

.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-brand { color: var(--brand); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; } .flex-1 { flex: 1 1 auto; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.full { width: 100%; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.scroll-y { overflow-y: auto; }
.kv { display: flex; gap: 12px; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { color: var(--muted); width: 116px; flex: 0 0 auto; }
.kv > span:last-child { flex: 1 1 auto; word-break: break-all; }
.copyable { cursor: pointer; }
.copyable:hover { color: var(--brand); }

/* ------------------------------------------------------------------ 响应式 */

@media (max-width: 1080px) {
    .grid--4, .grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.is-open { transform: none; box-shadow: var(--shadow-3); }
    .main { margin-left: 0; }
    .topbar__toggle { display: block; }
    .grid--2, .grid--3 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 27px; }
    .content { padding: 14px; }
    .drawer { width: 100%; }
}
@media (max-width: 560px) {
    .grid--4, .grid--5 { grid-template-columns: 1fr; }
    .stat__value { font-size: 22px; }
    .modal { max-width: 100%; }
    .card__body { padding: 14px; }
    .hide-sm { display: none !important; }
}

/* 打印（分享内容下载为 PDF 时保持干净） */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main { margin-left: 0; }
    .watermark-layer { display: none; }
}

/* ------------------------------------------------------------------ 可访问性
 * 键盘 Tab 到按钮/链接/输入框时给出清晰焦点环，便于键盘操作与录屏演示。
 * 用 :focus-visible 而不是 :focus，鼠标点击不会出现难看的描边。 */

/* 输入框已有 :focus 时的品牌色描边（见 .input:focus），这里不重复加环 */
.btn:focus-visible,
.nav-item:focus-visible,
a:focus-visible,
button:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ 图标（内联 SVG）
 * 统一由 Icon.svg() 生成。这里只负责"让 SVG 在各容器里对齐、不撑破布局"。
 * 早期版本用 emoji，在缺少 emoji 字体的 Windows / 国产浏览器里会渲染成方块。 */

.ico-svg {
    display: inline-block;
    vertical-align: -0.16em;
    flex: 0 0 auto;
    /* 线宽随尺寸微调：小图标线条略粗，大图标略细，观感更均匀 */
    stroke-width: 1.8;
    overflow: visible;
}
.ico-svg--lg { stroke-width: 1.5; }

/* 容器里带图标的场景 —— 用 flex 居中，尺寸由 svg 的 width/height 决定 */
.nav-item__icon,
.ftree__row .ico,
.filerow__ico,
.filegrid__item .ico,
.stat__icon,
.dropzone .ico,
.qi__ico,
.moveRow__ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
/* 去掉残留的 font-size 撑高，避免 SVG 容器被字号顶出多余高度 */
.nav-item__icon { font-size: 0; width: 20px; }
.ftree__row .ico { font-size: 0; width: 17px; }
.filerow__ico { font-size: 0; }
.filegrid__item .ico { font-size: 0; margin-bottom: 8px; }
.stat__icon { font-size: 0; }
.dropzone .ico { font-size: 0; }
.filerow__ico .ico-svg { color: var(--brand); }

/* 空状态图标 */
.empty__ico { display: flex; justify-content: center; color: var(--muted); opacity: .5; margin-bottom: 10px; }
.empty__ico .ico-svg { width: 30px; height: 30px; }

/* 按钮内联图标（如"上传文件"左侧的箭头） */
.btn .ico-svg { vertical-align: -0.2em; }
.btn--icon { padding: 0 9px; }
.btn--icon .ico-svg { vertical-align: 0; }

/* 表格里的小图标 */
.td .ico-svg, td .ico-svg { vertical-align: -0.2em; color: var(--muted); }

/* 预览降级态的大图标块 */
.pv-tone {
    width: 86px; height: 86px; border-radius: 20px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: var(--panel-2); color: var(--muted);
}
.pv-tone.is-doc { background: #eef4ff; color: #2563eb; }
.pv-tone.is-zip { background: #fdf6e3; color: #b45309; }
.pv-tone.is-audio { background: #eaf7ff; color: #0284c7; width: auto; height: auto; border-radius: 0; background: transparent; }

/* 预览舞台：统一留白，媒体元素不溢出 */
.preview-stage {
    display: flex; align-items: center; justify-content: center;
    min-height: 260px; max-height: 72vh; overflow: auto;
    background: var(--panel-2); border-radius: var(--radius-sm); padding: 12px;
}
.preview-stage > img,
.preview-stage > video { max-width: 100%; max-height: 68vh; border-radius: 8px; display: block; }
.preview-stage > iframe { width: 100%; height: 68vh; border: 0; border-radius: 8px; background: #fff; }
.preview-stage > audio { width: 100%; }
.preview-stage .text-view pre {
    color: #e2e8f0; margin: 0; white-space: pre-wrap; word-break: break-word;
    font-size: 12.5px; line-height: 1.75; font-family: var(--mono);
    background: #0f172a; border-radius: 9px; padding: 14px 16px;
}

/* [data-icon] 占位宿主：由 Icon.hydrate() 填成 SVG，保证行内对齐 */
.ico-host { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.ico-host .ico-svg { display: block; }
.payicon {
    width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand);
}

/* 文件类型配色 —— 让列表一眼可辨（文件夹/文档/表格/演示/图片/视频/音频/PDF/压缩包） */
.filerow__ico.is-folder { background: #fff7e6; color: #d97706; }
.filerow__ico.is-doc    { background: #eef4ff; color: #2563eb; }
.filerow__ico.is-sheet  { background: #eafaf1; color: #059669; }
.filerow__ico.is-slide  { background: #fff1eb; color: #ea580c; }
.filerow__ico.is-image  { background: #f5ebff; color: #7c3aed; }
.filerow__ico.is-video  { background: #ffeef4; color: #db2777; }
.filerow__ico.is-audio  { background: #eaf7ff; color: #0284c7; }
.filerow__ico.is-pdf    { background: #ffeded; color: #dc2626; }
.filerow__ico.is-zip    { background: #fdf6e3; color: #b45309; }
.filerow__ico.is-code   { background: #eef2f7; color: #334155; }

/* 自定义弹窗表单的底部操作条
 * 所有「footer:false + 自己拼按钮」的弹窗统一用它：分隔线 + 右侧对齐 + 固定间距。
 * 早前用 .inline.mt-16 拼，按钮会被上方的说明文字挤在一起（反馈的「按钮与文字重合」）。 */
.form-foot {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.form-foot .btn { flex: 0 0 auto; }

/* 品牌图片选择器（Logo / Favicon / 登录页背景）
 * 结构：.imgpick > .imgpick__thumb（预览）+ .imgpick__main（地址输入 + 上传/清除 + 提示）
 * 之前这三个字段只有一行文本框，必须先去别处取图床地址；现在可直接选文件上传。 */
.imgpick { display: flex; align-items: flex-start; gap: 12px; }
.imgpick__thumb {
    flex: 0 0 auto; width: 88px; height: 64px; border: 1px dashed var(--line);
    border-radius: 8px; background: var(--panel-2); display: flex;
    align-items: center; justify-content: center; overflow: hidden;
}
.imgpick__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.imgpick__main { flex: 1 1 auto; min-width: 0; }
.imgpick__main .flex { align-items: center; }
.imgpick__main .input { min-width: 0; }

/* 取密页细化：把视觉重心收到「输入密码 → 进入」这一步
 * 访客打开链接时只有一句诉求：密码填哪儿、填完点哪儿。
 * 品牌图标做成柔和的品牌色渐变块，主按钮加高加粗，密码框带聚焦光环。 */
.gate-card { max-width: 460px; }
.gate-card__head { padding: 32px 28px 20px; }
.gate-card__head .ico {
    width: 62px; height: 62px; border-radius: 18px;
    background: linear-gradient(140deg, var(--brand-soft), rgba(255, 255, 255, .55));
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12);
}
.gate-card__head h2 { font-size: 19px; }
.gate-card__body .field > label { font-weight: 600; color: var(--text-2); }
.gate-card__body .btn.full { height: 44px; font-size: 14px; font-weight: 600; border-radius: 10px; }
.code-input { border-color: rgba(37, 99, 235, .3); }
.code-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }
