/* ============================================================
   FileBox 管理后台 · 视觉系统
   三套界面风格（clarity / graphite / signal）× 明暗双主题。
   结构性 token（圆角等）只在风格块定义；色板在 6 个块中各自完整定义。
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --border: #e5e8f2;
  --border-strong: #ccd2e4;
  --text: #191b2e;
  --muted: #5b6178;
  --subtle: #8f96ad;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #ecebfe;
  --accent-2: #9333ea;
  --on-accent: #ffffff;
  --green: #0e7a4b;
  --green-soft: #e3f5ec;
  --amber: #9a5b00;
  --amber-soft: #fdf1da;
  --red: #d13b53;
  --red-soft: #fdedf0;
  --grad-1: #6366f1;
  --grad-2: #a855f7;
  --grad-3: #ec4899;
  --accent-grad: linear-gradient(135deg, #5b54ec, #7743ea);
  --sidebar-bg: #ffffff;
  --sidebar-text: #1c1e33;
  --sidebar-muted: #61687f;
  --sidebar-active-bg: #ecebfe;
  --sidebar-active-text: #4338ca;
  --sidebar-border: #e5e8f2;
  --sidebar-hover: #f3f4fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 25, 46, .05);
  --panel-shadow: 0 1px 2px rgba(23, 25, 46, .04), 0 10px 28px -14px rgba(23, 25, 46, .08);
  --shadow: 0 24px 60px -16px rgba(23, 25, 46, .22);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

/* —— 清朗 Clarity：产品同源的靛紫品牌色，明快通透（默认） —— */
:root[data-style="clarity"] {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --border: #e5e8f2;
  --border-strong: #ccd2e4;
  --text: #191b2e;
  --muted: #5b6178;
  --subtle: #8f96ad;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #ecebfe;
  --accent-2: #9333ea;
  --on-accent: #ffffff;
  --green: #0e7a4b;
  --green-soft: #e3f5ec;
  --amber: #9a5b00;
  --amber-soft: #fdf1da;
  --red: #d13b53;
  --red-soft: #fdedf0;
  --grad-1: #6366f1;
  --grad-2: #a855f7;
  --grad-3: #ec4899;
  --accent-grad: linear-gradient(135deg, #5b54ec, #7743ea);
  --sidebar-bg: #ffffff;
  --sidebar-text: #1c1e33;
  --sidebar-muted: #61687f;
  --sidebar-active-bg: #ecebfe;
  --sidebar-active-text: #4338ca;
  --sidebar-border: #e5e8f2;
  --sidebar-hover: #f3f4fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 25, 46, .05);
  --panel-shadow: 0 1px 2px rgba(23, 25, 46, .04), 0 10px 28px -14px rgba(23, 25, 46, .08);
  --shadow: 0 24px 60px -16px rgba(23, 25, 46, .22);
}

/* —— 石墨 Graphite：单色专业风，黑白灰 + 一点青 —— */
:root[data-style="graphite"] {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #e4e4e7;
  --border-strong: #d0d0d5;
  --text: #151519;
  --muted: #54545e;
  --subtle: #8e8e98;
  --accent: #18181b;
  --accent-strong: #000000;
  --accent-soft: #ededf0;
  --accent-2: #0d9488;
  --on-accent: #ffffff;
  --green: #0f7a52;
  --green-soft: #e5f4ee;
  --amber: #955407;
  --amber-soft: #faf0dc;
  --red: #cf3a4d;
  --red-soft: #fceef0;
  --grad-1: #3f3f46;
  --grad-2: #18181b;
  --grad-3: #52525b;
  --accent-grad: linear-gradient(180deg, #2d2d33, #131316);
  --sidebar-bg: #111114;
  --sidebar-text: #f4f4f5;
  --sidebar-muted: #93939e;
  --sidebar-active-bg: #232329;
  --sidebar-active-text: #5eead4;
  --sidebar-border: #111114;
  --sidebar-hover: #1a1a1f;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, .05);
  --panel-shadow: 0 1px 2px rgba(9, 9, 11, .04);
  --shadow: 0 24px 48px -16px rgba(9, 9, 11, .2);
}

/* —— 信号 Signal：暖纸底色 + 珊瑚红与松绿，编辑部气质 —— */
:root[data-style="signal"] {
  --bg: #f7f5ef;
  --surface: #fffefb;
  --surface-2: #f7f4ec;
  --border: #e7e1d2;
  --border-strong: #d2c9b4;
  --text: #221f18;
  --muted: #6b6455;
  --subtle: #9a927e;
  --accent: #dd4f42;
  --accent-strong: #c74335;
  --accent-soft: #fceee9;
  --accent-2: #0f8582;
  --on-accent: #ffffff;
  --green: #1e7a50;
  --green-soft: #e5f3ea;
  --amber: #9c6a00;
  --amber-soft: #f9efd7;
  --red: #c93a52;
  --red-soft: #fbecee;
  --grad-1: #f59e5b;
  --grad-2: #e3514f;
  --grad-3: #c73e83;
  --accent-grad: linear-gradient(135deg, #ea6a50, #d8443c);
  --sidebar-bg: #153f3b;
  --sidebar-text: #f1faf6;
  --sidebar-muted: #8fb5ac;
  --sidebar-active-bg: #26564f;
  --sidebar-active-text: #ffb2a0;
  --sidebar-border: #153f3b;
  --sidebar-hover: #1c4a44;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(34, 31, 24, .05);
  --panel-shadow: 0 1px 2px rgba(34, 31, 24, .04), 0 12px 30px -16px rgba(34, 31, 24, .1);
  --shadow: 0 24px 56px -16px rgba(34, 31, 24, .24);
}

:root.dark {
  color-scheme: dark;
  --bg: #0d0f1a;
  --surface: #141726;
  --surface-2: #1b1f33;
  --border: #252a44;
  --border-strong: #3a4166;
  --text: #e9ecfa;
  --muted: #a3aac6;
  --subtle: #6e7695;
  --accent: #818cf8;
  --accent-strong: #a5acff;
  --accent-soft: #252a52;
  --accent-2: #c084fc;
  --on-accent: #0e1030;
  --green: #5cd695;
  --green-soft: #153327;
  --amber: #f5bd4f;
  --amber-soft: #3a2c12;
  --red: #fb7d90;
  --red-soft: #3f202b;
  --grad-1: #818cf8;
  --grad-2: #c084fc;
  --grad-3: #f472b6;
  --accent-grad: linear-gradient(135deg, #8a94ff, #a273ff);
  --sidebar-bg: #0f1120;
  --sidebar-text: #e9ecfa;
  --sidebar-muted: #8189a8;
  --sidebar-active-bg: #262b52;
  --sidebar-active-text: #aab3ff;
  --sidebar-border: #22263e;
  --sidebar-hover: #171a2f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --panel-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 12px 30px -14px rgba(0, 0, 0, .35);
  --shadow: 0 28px 70px -16px rgba(0, 0, 0, .55);
}

:root.dark[data-style="clarity"] {
  --bg: #0d0f1a;
  --surface: #141726;
  --surface-2: #1b1f33;
  --border: #252a44;
  --border-strong: #3a4166;
  --text: #e9ecfa;
  --muted: #a3aac6;
  --subtle: #6e7695;
  --accent: #818cf8;
  --accent-strong: #a5acff;
  --accent-soft: #252a52;
  --accent-2: #c084fc;
  --on-accent: #0e1030;
  --green: #5cd695;
  --green-soft: #153327;
  --amber: #f5bd4f;
  --amber-soft: #3a2c12;
  --red: #fb7d90;
  --red-soft: #3f202b;
  --grad-1: #818cf8;
  --grad-2: #c084fc;
  --grad-3: #f472b6;
  --accent-grad: linear-gradient(135deg, #8a94ff, #a273ff);
  --sidebar-bg: #0f1120;
  --sidebar-text: #e9ecfa;
  --sidebar-muted: #8189a8;
  --sidebar-active-bg: #262b52;
  --sidebar-active-text: #aab3ff;
  --sidebar-border: #22263e;
  --sidebar-hover: #171a2f;
}

:root.dark[data-style="graphite"] {
  --bg: #0a0a0c;
  --surface: #111113;
  --surface-2: #18181c;
  --border: #242429;
  --border-strong: #39393f;
  --text: #f4f4f5;
  --muted: #a4a4ae;
  --subtle: #70707a;
  --accent: #fafafa;
  --accent-strong: #ffffff;
  --accent-soft: #212126;
  --accent-2: #2dd4bf;
  --on-accent: #0c0c0e;
  --green: #54d896;
  --green-soft: #122b1f;
  --amber: #f6c256;
  --amber-soft: #332711;
  --red: #ff7c8d;
  --red-soft: #391d24;
  --grad-1: #fafafa;
  --grad-2: #d4d4d8;
  --grad-3: #ffffff;
  --accent-grad: linear-gradient(180deg, #ffffff, #e6e6ea);
  --sidebar-bg: #08080a;
  --sidebar-text: #f4f4f5;
  --sidebar-muted: #84848e;
  --sidebar-active-bg: #1d1d22;
  --sidebar-active-text: #5eead4;
  --sidebar-border: #1c1c21;
  --sidebar-hover: #131317;
}

:root.dark[data-style="signal"] {
  --bg: #131311;
  --surface: #1b1b18;
  --surface-2: #23231f;
  --border: #33322c;
  --border-strong: #4b4a41;
  --text: #f3f1e9;
  --muted: #b4ad9d;
  --subtle: #7f7969;
  --accent: #ff8272;
  --accent-strong: #ff9a8c;
  --accent-soft: #3d2521;
  --accent-2: #4cc9c2;
  --on-accent: #26100c;
  --green: #63cf9e;
  --green-soft: #1a3529;
  --amber: #f2bd58;
  --amber-soft: #372b14;
  --red: #ff8296;
  --red-soft: #3f2129;
  --grad-1: #ffb27a;
  --grad-2: #ff7f6e;
  --grad-3: #e86aa8;
  --accent-grad: linear-gradient(135deg, #ff8e77, #f76a5e);
  --sidebar-bg: #0e1a18;
  --sidebar-text: #f1faf6;
  --sidebar-muted: #7fa39a;
  --sidebar-active-bg: #1f3b36;
  --sidebar-active-text: #ffa896;
  --sidebar-border: #1b2b28;
  --sidebar-hover: #152622;
}

/* ============ 基础 ============ */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; font-size: .9375rem; line-height: 1.5; transition: background-color .25s ease, color .25s ease; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(52rem 32rem at 106% -6%, color-mix(in srgb, var(--grad-2) 8%, transparent), transparent 62%),
    radial-gradient(44rem 30rem at -8% 108%, color-mix(in srgb, var(--grad-1) 7%, transparent), transparent 62%);
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
:where(a, button):focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent); outline-offset: 2px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ============ 表单控件 ============ */
input, select, textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
input, select { min-height: 2.6rem; padding: .55rem .8rem; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.1rem; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23898fa3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; }
textarea { padding: .7rem .85rem; resize: vertical; line-height: 1.6; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 34%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 16%, transparent); }
input[type="checkbox"] { accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--subtle); }

.button { min-height: 2.55rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1.05rem; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; font-size: .855rem; font-weight: 650; white-space: nowrap; flex: none; transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease, filter .15s ease; }
.button.primary { background: var(--accent); background-image: var(--accent-grad); color: var(--on-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 8px 20px -8px color-mix(in srgb, var(--accent) 55%, transparent); }
.button.primary:hover { filter: brightness(1.06); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 10px 24px -8px color-mix(in srgb, var(--accent) 65%, transparent); }
.button.secondary { border-color: var(--border-strong); background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.button.secondary:hover { border-color: color-mix(in srgb, var(--accent) 38%, var(--border-strong)); color: var(--accent); }
.button.danger { border-color: color-mix(in srgb, var(--red) 32%, transparent); background: var(--red-soft); color: var(--red); }
.button.danger:hover { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: color-mix(in srgb, var(--red) 14%, var(--red-soft)); }
.button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.button:not(:disabled):active { transform: translateY(1px); }
.button.wide { width: 100%; }
.button.small { min-height: 2.1rem; padding: .35rem .7rem; font-size: .78rem; border-radius: calc(var(--radius-sm) - 2px); }
.icon-button { width: 2.45rem; height: 2.45rem; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); cursor: pointer; box-shadow: var(--shadow-sm); transition: color .15s ease, background-color .15s ease, border-color .15s ease, transform .15s ease; }
.icon-button:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 36%, var(--border-strong)); background: var(--surface-2); }
.icon-button:active { transform: translateY(1px); }
.text-button { display: inline-flex; align-items: center; gap: .25rem; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: .8rem; font-weight: 600; }
.text-button:hover { color: var(--accent-strong); }
.text-button svg { width: .9rem; height: .9rem; }

/* ============ 登录页 ============ */
.login-page { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; overflow: hidden; }
.login-ambient { position: absolute; inset: 0; pointer-events: none; }
.login-ambient i { position: absolute; display: block; border-radius: 50%; filter: blur(72px); opacity: .5; }
.login-ambient i:nth-child(1) { width: 30rem; height: 30rem; left: -9rem; top: -11rem; background: color-mix(in srgb, var(--grad-1) 38%, transparent); }
.login-ambient i:nth-child(2) { width: 26rem; height: 26rem; right: -8rem; top: 18%; background: color-mix(in srgb, var(--grad-2) 30%, transparent); animation: float-slow 11s ease-in-out infinite alternate; }
.login-ambient i:nth-child(3) { width: 24rem; height: 24rem; left: 24%; bottom: -13rem; background: color-mix(in srgb, var(--grad-3) 24%, transparent); animation: float-slow 13s ease-in-out infinite alternate-reverse; }
:root.dark .login-ambient i { opacity: .26; }
@keyframes float-slow { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, 2.2rem, 0); } }
.login-panel { position: relative; width: min(100%, 26rem); padding: 2.4rem 2.2rem 2rem; border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow); animation: rise-in .4s cubic-bezier(.22, .8, .3, 1); }
.login-brand { display: flex; align-items: center; gap: .8rem; }
.login-brand-text strong { display: block; font-size: 1rem; letter-spacing: .01em; }
.login-brand-text small { display: block; margin-top: .15rem; color: var(--subtle); font-size: .66rem; font-weight: 750; letter-spacing: .14em; }
.login-panel h1 { margin: 1.6rem 0 .3rem; font-size: 1.45rem; letter-spacing: -.01em; }
.login-sub { margin: 0 0 .4rem; color: var(--muted); font-size: .84rem; }
.login-panel label, .dialog label, .drawer-form label, .account-form label { display: grid; gap: .45rem; margin-top: 1.05rem; color: var(--muted); font-size: .8rem; font-weight: 650; }
.login-panel input { min-height: 2.75rem; }
.login-panel .button.primary { min-height: 2.75rem; margin-top: .3rem; font-size: .92rem; letter-spacing: .14em; }
.brand-mark { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; flex: none; color: #fff; background: var(--accent); background-image: linear-gradient(135deg, var(--grad-1), var(--grad-2) 55%, var(--grad-3)); border-radius: 12px; box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--grad-2) 60%, transparent); }
.brand-mark svg { width: 1.45rem; height: 1.45rem; }
.brand-mark.small { width: 2.3rem; height: 2.3rem; border-radius: 10px; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--grad-2) 55%, transparent); }
.brand-mark.small svg { width: 1.2rem; height: 1.2rem; }
:root[data-style="graphite"] .brand-mark { color: var(--on-accent); }
.eyebrow { margin: 1rem 0 0; color: var(--subtle); font-size: .66rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.back-link { display: block; margin-top: 1.4rem; color: var(--muted); font-size: .82rem; text-align: center; text-decoration: none; transition: color .15s ease; }
.back-link:hover { color: var(--accent); }
.form-error { min-height: 1.25rem; margin: .7rem 0 .4rem; color: var(--red); font-size: .82rem; }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

/* ============ 应用骨架 ============ */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 15.5rem; display: flex; flex-direction: column; padding: 1.1rem .95rem 1rem; border-right: 1px solid var(--sidebar-border); background: var(--sidebar-bg); color: var(--sidebar-text); }
.brand { min-height: 3.3rem; display: flex; align-items: center; gap: .75rem; padding: .3rem .45rem; color: var(--sidebar-text); text-decoration: none; border-radius: var(--radius-sm); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .95rem; letter-spacing: .01em; }
.brand small { margin-top: .15rem; color: var(--sidebar-muted); font-size: .68rem; }
.nav { display: grid; gap: .3rem; margin-top: 1.5rem; }
.nav-item { position: relative; width: 100%; min-height: 2.7rem; display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--sidebar-muted); cursor: pointer; text-align: left; font-size: .875rem; font-weight: 600; transition: color .15s ease, background-color .15s ease; }
.nav-item svg { width: 1.1rem; height: 1.1rem; opacity: .9; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: -.95rem; top: .65rem; bottom: .65rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--sidebar-active-text); }
.sidebar-foot { margin-top: auto; padding: 1rem .8rem .3rem; border-top: 1px solid color-mix(in srgb, var(--sidebar-muted) 22%, transparent); }
.sidebar-foot a { color: var(--sidebar-muted); font-size: .78rem; text-decoration: none; transition: color .15s ease; }
.sidebar-foot a:hover { color: var(--sidebar-text); }
.workspace { min-height: 100vh; margin-left: 15.5rem; }
.topbar { position: sticky; top: 0; z-index: 18; min-height: 4.6rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 2.25rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.topbar h1 { margin: .15rem 0 0; font-size: 1.28rem; font-weight: 750; letter-spacing: -.01em; }
.topbar .eyebrow { margin: 0; font-size: .62rem; }
.top-actions { display: flex; align-items: center; gap: .5rem; }
.user-chip { max-width: 11rem; display: inline-flex; align-items: center; gap: .45rem; overflow: hidden; padding: .42rem .8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--muted); font-size: .78rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.user-chip::before { content: ""; width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.mobile-nav { display: none; }
.content { width: min(100%, 88rem); margin: 0 auto; padding: 1.9rem 2.25rem 3.5rem; }
.view { display: none; }
.view.active { display: block; animation: view-in .22s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.section-head { min-height: 3.1rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-head h2 { margin: 0; font-size: 1.18rem; font-weight: 750; letter-spacing: -.01em; }
.section-head p { margin: .35rem 0 0; color: var(--muted); font-size: .8rem; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.segmented button { min-height: 1.95rem; padding: .3rem .7rem; border: 0; border-radius: calc(var(--radius-sm) - 4px); background: transparent; color: var(--muted); cursor: pointer; font-size: .74rem; font-weight: 600; transition: color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: var(--shadow-sm); }

/* ============ 概览 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-card { position: relative; min-height: 7.2rem; padding: 1.1rem 1.2rem 1.15rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--panel-shadow); transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.stat-card:hover { border-color: color-mix(in srgb, var(--accent) 26%, var(--border)); transform: translateY(-2px); box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--text) 22%, transparent); }
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.stat-card .label { color: var(--muted); font-size: .78rem; font-weight: 600; }
.stat-icon { width: 2.35rem; height: 2.35rem; display: grid; place-items: center; flex: none; border-radius: calc(var(--radius-sm) + 1px); color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); }
.stat-icon svg { width: 1.15rem; height: 1.15rem; }
.stat-card:nth-child(2) .stat-icon { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 11%, transparent); }
.stat-card:nth-child(3) .stat-icon { color: var(--green); background: color-mix(in srgb, var(--green) 11%, transparent); }
.stat-card:nth-child(4) .stat-icon { color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); }
.stat-card .value { margin-top: .55rem; font-size: 1.8rem; font-weight: 760; letter-spacing: -.025em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-card .meta { margin-top: .3rem; color: var(--subtle); font-size: .74rem; font-variant-numeric: tabular-nums; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(17rem, .8fr); gap: 1rem; margin-bottom: 1rem; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--panel-shadow); }
.panel-head { min-height: 3.2rem; display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.panel-head h3, .panel-head h4 { margin: 0; font-size: .92rem; font-weight: 700; }
.chart-panel { overflow: hidden; }
.trend-chart { position: relative; height: 15rem; display: flex; align-items: flex-end; gap: 4px; padding: 1.4rem 1.25rem 1rem; background-image: linear-gradient(color-mix(in srgb, var(--border) 55%, transparent) 1px, transparent 1px); background-size: 100% calc((100% - 2.4rem) / 4); background-position: 0 1.4rem; background-repeat: repeat-y; }
.trend-bucket { position: relative; min-width: 4px; flex: 1; height: 100%; display: flex; align-items: flex-end; gap: 2px; border-radius: 4px; transition: background-color .15s ease; }
.trend-bucket:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.trend-bar { min-height: 0; flex: 1; border-radius: 3px 3px 0 0; transition: filter .15s ease; }
.trend-bucket:hover .trend-bar { filter: brightness(1.12); }
.trend-bar.upload { background: var(--accent); }
.trend-bar.receive { background: var(--accent-2); }
.trend-bar.failure { background: var(--red); }
.chart-legend { display: flex; gap: .85rem; color: var(--muted); font-size: .72rem; font-weight: 600; }
.chart-legend span { display: inline-flex; align-items: center; }
.chart-legend span::before { content: ""; width: .55rem; height: .55rem; display: inline-block; margin-right: .35rem; border-radius: 3px; }
.chart-legend .upload::before { background: var(--accent); }
.chart-legend .receive::before { background: var(--accent-2); }
.chart-legend .failure::before { background: var(--red); }
.storage-panel > div:last-child { padding: 1.2rem 1.25rem; }
.storage-number { margin: .2rem 0 1rem; font-size: 1.55rem; font-weight: 760; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.progress { height: .6rem; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--border) 55%, var(--surface-2)); }
.progress span { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s cubic-bezier(.22, .8, .3, 1); }
.progress span.warn { background: linear-gradient(90deg, var(--amber), color-mix(in srgb, var(--amber) 70%, var(--red))); }
.progress span.danger { background: linear-gradient(90deg, color-mix(in srgb, var(--red) 80%, var(--amber)), var(--red)); }
.storage-list { display: grid; gap: .15rem; margin-top: 1.05rem; }
.storage-list div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px dashed color-mix(in srgb, var(--border) 80%, transparent); color: var(--muted); font-size: .78rem; }
.storage-list div:last-child { border-bottom: 0; }
.storage-list strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ============ 表格 ============ */
.table-panel { overflow: hidden; }
.table-scroll { width: 100%; overflow: auto; }
.table-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--border-strong) 80%, transparent); background-clip: padding-box; }
table { width: 100%; border-collapse: collapse; min-width: 46rem; }
th, td { padding: .72rem 1rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 1.25rem; }
th:last-child, td:last-child { padding-right: 1.25rem; }
th { position: sticky; top: 0; z-index: 2; color: var(--subtle); background: var(--surface); box-shadow: inset 0 -1px 0 var(--border); border-bottom: 0; font-size: .67rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
td { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
tbody tr { transition: background-color .12s ease; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 42%, transparent); }
.code { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .05em; }
.content-cell { max-width: 20rem; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
/* 注意：这是 <td>，不能用 display:flex（会脱离表格布局导致行边框断裂错位） */
.row-actions { text-align: right; white-space: nowrap; }
.row-actions button { width: 2rem; height: 2rem; display: inline-grid; place-items: center; vertical-align: middle; padding: 0; border: 0; border-radius: calc(var(--radius-sm) - 3px); background: transparent; color: var(--muted); cursor: pointer; transition: color .15s ease, background-color .15s ease; }
.row-actions button + button { margin-left: .25rem; }
.row-actions button:hover { background: var(--accent-soft); color: var(--accent); }
.row-actions button.danger:hover { background: var(--red-soft); color: var(--red); }
.badge { display: inline-flex; align-items: center; gap: .32rem; min-height: 1.45rem; padding: .18rem .55rem; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.badge::before { content: ""; width: .38rem; height: .38rem; border-radius: 50%; background: currentColor; }
.badge.success { color: var(--green); background: var(--green-soft); }
.badge.warning { color: var(--amber); background: var(--amber-soft); }
.badge.danger { color: var(--red); background: var(--red-soft); }
.badge.neutral { color: var(--muted); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.empty-state { padding: 3.2rem 1rem; color: var(--subtle); text-align: center; font-size: .84rem; }

/* ============ 工具栏 / 批量操作 / 分页 ============ */
.toolbar { display: grid; grid-template-columns: minmax(16rem, 1fr) repeat(3, minmax(8.5rem, auto)); gap: .6rem; margin-bottom: .85rem; }
.toolbar.audit-toolbar { grid-template-columns: repeat(3, minmax(8.5rem, auto)) minmax(14rem, 1fr); }
.toolbar.audit-toolbar .search-box { justify-self: end; width: min(100%, 18rem); }
.search-box { min-height: 2.6rem; display: flex; align-items: center; gap: .55rem; padding: 0 .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--subtle); box-shadow: var(--shadow-sm); transition: border-color .15s ease, box-shadow .15s ease; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 16%, transparent); }
.search-box svg { width: 1rem; height: 1rem; }
.search-box input { min-height: 2.3rem; padding: 0; border: 0; box-shadow: none !important; background: transparent; }
.search-box.compact { min-width: 12rem; }
.bulk-bar { min-height: 3.1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; padding: .55rem .7rem .55rem 1.1rem; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); color: var(--muted); font-size: .8rem; animation: view-in .18s ease; }
.bulk-bar strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.pagination { min-height: 2.5rem; display: flex; align-items: center; justify-content: flex-end; gap: .35rem; margin-top: .85rem; }
.pagination button { min-width: 2.15rem; height: 2.15rem; border: 1px solid var(--border); border-radius: calc(var(--radius-sm) - 2px); background: var(--surface); color: var(--muted); cursor: pointer; font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; transition: color .15s ease, border-color .15s ease, background-color .15s ease; }
.pagination button:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); color: var(--accent); }
.pagination button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 750; }

/* ============ 设置 ============ */
.settings-section { margin-bottom: 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--panel-shadow); }
.settings-title { min-height: 3.3rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.settings-title h3 { margin: 0; font-size: .92rem; font-weight: 700; }
.setting-row { min-height: 4.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; padding: .95rem 1.25rem; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong, .setting-row small { display: block; }
.setting-row strong { font-size: .84rem; font-weight: 650; }
.setting-row small { margin-top: .28rem; color: var(--muted); font-size: .74rem; font-weight: 400; }
.setting-row.form-row > label { min-width: 12rem; }
.setting-row.vertical { align-items: stretch; flex-direction: column; }
.inline-form, .number-field { width: min(100%, 28rem); display: flex; align-items: center; gap: .55rem; }
.number-field input { max-width: 7.5rem; }
.number-field span { color: var(--muted); font-size: .78rem; }
.align-right { display: flex; justify-content: flex-end; }
.switch { position: relative; width: 2.8rem; height: 1.55rem; flex: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: background-color .2s ease, box-shadow .2s ease; }
.switch span::before { content: ""; position: absolute; width: 1.18rem; height: 1.18rem; left: .19rem; top: .18rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s cubic-bezier(.22, .8, .3, 1); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(1.24rem); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 20%, transparent); }
.maintenance-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; padding: 1.1rem 1.25rem; }
.maintenance-item { position: relative; min-height: 6.2rem; padding: .95rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; transition: border-color .15s ease, background-color .15s ease, transform .15s ease; }
.maintenance-item:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--border-strong)); }
.maintenance-item:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.maintenance-item:has(input:disabled) { cursor: default; opacity: .6; }
.maintenance-item:has(input:disabled):hover { border-color: var(--border); }
.maintenance-item input { position: absolute; top: .85rem; right: .85rem; width: 1.05rem; min-height: 1.05rem; cursor: inherit; }
.maintenance-item strong { display: block; font-size: .8rem; color: var(--muted); font-weight: 650; }
.maintenance-item b { display: block; margin-top: .7rem; font-size: 1.45rem; font-weight: 760; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.maintenance-item small { color: var(--subtle); font-size: .72rem; font-variant-numeric: tabular-nums; }
.maintenance-action { display: flex; justify-content: flex-end; padding: 0 1.25rem 1.2rem; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1.1rem 1.25rem; }
.account-form { padding: 1.15rem 1.2rem 1.3rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.account-form h4 { margin: 0 0 .4rem; font-size: .86rem; font-weight: 700; }
.account-form .button { margin-top: 1.15rem; }
.security-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: .72rem; font-weight: 700; }
.security-badge svg { width: .9rem; height: .9rem; }
.sessions { margin: 0 1.25rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.sessions .panel-head { min-height: 2.9rem; padding: .7rem 1.1rem; background: var(--surface-2); }
.session-row { display: grid; grid-template-columns: 1fr 1.5fr auto; gap: 1rem; align-items: center; padding: .8rem 1.1rem; border-top: 1px solid var(--border); font-size: .78rem; }
.session-row:first-child { border-top: 0; }
.session-row > div:first-child { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.session-row > div:nth-child(2) { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.session-row small { display: block; margin-top: .2rem; color: var(--subtle); font-weight: 400; }
.session-current { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: .72rem; font-weight: 700; }
.session-current::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }

/* ============ 抽屉 / 对话框 / Toast ============ */
.drawer { position: fixed; inset: 0 0 0 auto; z-index: 80; width: min(33rem, 100%); display: flex; flex-direction: column; border-left: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow); }
.drawer:not([hidden]) { animation: drawer-in .32s cubic-bezier(.22, .8, .3, 1); }
@keyframes drawer-in { from { transform: translateX(2.5rem); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.drawer-head .eyebrow { margin: 0; }
.drawer-head h2 { margin: .3rem 0 0; font-size: 1.5rem; font-weight: 760; letter-spacing: .06em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--accent); }
.drawer-body { flex: 1; overflow: auto; padding: 1.4rem; }
.drawer-actions { display: flex; gap: .6rem; padding: 1rem 1.4rem; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.drawer-actions .button { flex: 1; }
.detail-preview { max-height: 16rem; overflow: auto; margin: 0 0 1.2rem; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: .8rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.detail-list { display: grid; grid-template-columns: 7rem 1fr; margin: 0; border-top: 1px solid var(--border); }
.detail-list dt, .detail-list dd { margin: 0; padding: .68rem 0; border-bottom: 1px solid var(--border); font-size: .8rem; }
.detail-list dt { color: var(--subtle); }
.detail-list dd { color: var(--text); text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.drawer-form { margin-top: 1.2rem; }
.drawer-form .button { width: 100%; margin-top: 1.15rem; }
.backdrop { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, #070a14 45%, transparent); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fade-in .2s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.dialog { width: min(calc(100% - 2rem), 27rem); padding: 0; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dialog[open] { animation: dialog-in .2s cubic-bezier(.22, .8, .3, 1); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog::backdrop { background: rgba(7, 10, 20, .5); backdrop-filter: blur(3px); }
.dialog form { padding: 1.5rem; }
.dialog h2 { margin: 0; font-size: 1.08rem; font-weight: 750; }
.dialog p { color: var(--muted); font-size: .84rem; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: 1.3rem; }

.toast-region { position: fixed; z-index: 100; right: 1.1rem; bottom: 1.1rem; width: min(calc(100% - 2.2rem), 22rem); display: grid; gap: .55rem; }
.toast { padding: .8rem 1rem .8rem 1.05rem; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); color: var(--text); font-size: .82rem; animation: toast-in .28s cubic-bezier(.22, .8, .3, 1); }
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ 风格切换菜单 ============ */
.style-picker { position: relative; }
.style-menu { position: absolute; top: calc(100% + .6rem); right: 0; z-index: 60; width: 15rem; padding: .5rem; border: 1px solid var(--border); border-radius: calc(var(--radius-sm) + 4px); background: var(--surface); box-shadow: var(--shadow); animation: style-menu-in .18s cubic-bezier(.22, .8, .3, 1); }
.style-menu-title { padding: .5rem .6rem .4rem; color: var(--subtle); font-size: .64rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.style-choice { width: 100%; min-height: 3.3rem; display: grid; grid-template-columns: 3.2rem 1fr 1.05rem; align-items: center; gap: .7rem; padding: .5rem .6rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); cursor: pointer; text-align: left; transition: background-color .15s ease; }
.style-choice:hover { background: var(--surface-2); }
.style-choice.active { background: var(--accent-soft); }
.style-choice strong, .style-choice small { display: block; }
.style-choice strong { font-size: .8rem; font-weight: 700; }
.style-choice small { margin-top: .12rem; color: var(--muted); font-size: .64rem; letter-spacing: .06em; }
.style-choice b { width: .9rem; height: .9rem; display: grid; place-items: center; border: 1.5px solid var(--border-strong); border-radius: 50%; transition: border-color .15s ease, background-color .15s ease; }
.style-choice.active b { border-color: var(--accent); background: var(--accent); }
.style-choice.active b::after { content: ""; width: .3rem; height: .3rem; border-radius: 50%; background: var(--on-accent); }
.style-swatch { position: relative; height: 2rem; display: grid; grid-template-columns: 1.05rem 1fr; overflow: hidden; border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); border-radius: 7px; }
.style-swatch i { display: block; }
.style-swatch i:nth-child(3) { position: absolute; right: .3rem; bottom: .3rem; width: .55rem; height: .55rem; border-radius: 50%; }
.swatch-clarity i:nth-child(1) { background: #ffffff; }
.swatch-clarity i:nth-child(2) { background: #eef0fb; }
.swatch-clarity i:nth-child(3) { background: #4f46e5; }
.swatch-graphite i:nth-child(1) { background: #111114; }
.swatch-graphite i:nth-child(2) { background: #f4f4f5; }
.swatch-graphite i:nth-child(3) { background: #0d9488; }
.swatch-signal i:nth-child(1) { background: #153f3b; }
.swatch-signal i:nth-child(2) { background: #f7f5ef; }
.swatch-signal i:nth-child(3) { background: #dd4f42; }
@keyframes style-menu-in { from { opacity: 0; transform: translateY(-5px) scale(.99); } to { opacity: 1; transform: none; } }

/* ============ 风格个性化补充 ============ */
:root[data-style="graphite"] .eyebrow { color: var(--accent-2); }
:root[data-style="graphite"] th { letter-spacing: .1em; }
:root[data-style="graphite"] .brand-mark, :root[data-style="graphite"] .brand-mark.small { box-shadow: none; }
:root[data-style="graphite"] .button.primary { box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
:root[data-style="graphite"] body::before, :root.dark[data-style="graphite"] body::before { background: none; }
:root[data-style="signal"] .drawer-head h2 { color: var(--accent-2); }
:root[data-style="signal"] .topbar .eyebrow { color: color-mix(in srgb, var(--accent-2) 75%, var(--subtle)); }
:root.dark[data-style="clarity"] .user-chip, :root.dark[data-style="signal"] .user-chip { background: var(--surface-2); }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .maintenance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .workspace { margin-left: 0; }
  .topbar { min-height: 4.1rem; padding: .65rem 1rem; }
  .topbar .eyebrow, .user-chip { display: none; }
  .topbar h1 { font-size: 1.08rem; }
  .mobile-nav { position: sticky; top: 4.1rem; z-index: 15; display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; padding: .5rem .75rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .mobile-nav button { min-height: 2.35rem; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 600; transition: color .15s ease, background-color .15s ease; }
  .mobile-nav button.active { border-color: color-mix(in srgb, var(--accent) 26%, transparent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
  .topbar { top: 0; }
  .content { padding: 1.2rem 1rem 2.6rem; }
  .section-head { align-items: stretch; flex-direction: column; min-height: 0; }
  .segmented { align-self: flex-start; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .stat-card { min-height: 6.2rem; padding: .95rem 1rem 1rem; }
  .stat-card .value { font-size: 1.4rem; }
  .stat-icon { width: 2.1rem; height: 2.1rem; }
  .trend-chart { height: 12rem; padding: 1.1rem .9rem .9rem; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search-box { grid-column: 1 / -1; }
  .audit-toolbar .search-box { grid-column: 1 / -1; justify-self: stretch; width: 100%; }
  .maintenance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 1rem; }
  .account-grid { grid-template-columns: 1fr; padding: 1rem; }
  .sessions { margin: 0 1rem 1rem; }
  .maintenance-action { padding: 0 1rem 1rem; }
  .setting-row { align-items: stretch; flex-direction: column; padding: .95rem 1rem; }
  .setting-row:not(.form-row) { align-items: center; flex-direction: row; }
  .setting-row.form-row > label, .inline-form, .number-field { width: 100%; min-width: 0; }
  .settings-title, .panel-head { padding-left: 1rem; padding-right: 1rem; }
  th:first-child, td:first-child { padding-left: 1rem; }
  th:last-child, td:last-child { padding-right: 1rem; }
  .session-row { grid-template-columns: 1fr auto; }
  .session-row > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .drawer-head { padding: 1rem 1.1rem; }
  .drawer-body { padding: 1.1rem; }
  .drawer-actions { padding: .9rem 1.1rem; }
}

@media (max-width: 430px) {
  .login-panel { padding: 1.7rem 1.35rem 1.5rem; }
  .top-actions { gap: .35rem; }
  .icon-button { width: 2.2rem; height: 2.2rem; }
  .stat-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar .search-box { grid-column: auto; }
  .drawer-actions { display: grid; grid-template-columns: repeat(2, 1fr); }
  .drawer-actions .danger { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- 在线预览 */
.preview-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: color-mix(in srgb, #070a14 55%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade-in .2s ease; }
.preview-modal { width: min(52rem, 100%); max-height: 90vh; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
/* 全屏：API 全屏与 CSS 回退（iPhone 等）共用 .pv-fs 调整尺寸 */
.preview-modal.pv-fs { width: 100%; height: 100%; max-height: none; border-radius: 0; }
.preview-modal.pv-fs-css { position: fixed; inset: 0; z-index: 95; }
.preview-head { display: flex; align-items: center; gap: .75rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); }
.preview-head h3 { flex: 1; min-width: 0; margin: 0; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.preview-ops { display: flex; align-items: center; gap: .5rem; }
.pv-count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.preview-stage { position: relative; flex: 1; min-height: 14rem; display: flex; }
.preview-body { flex: 1; min-width: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: .75rem; background: var(--surface-2); }
.preview-body img, .preview-body video { max-width: 100%; max-height: 70vh; border-radius: var(--radius-sm); }
.preview-body video { width: 100%; background: #000; }
.preview-body audio { width: 100%; }
.preview-body iframe { width: 100%; height: 70vh; border: 0; border-radius: var(--radius-sm); background: #fff; }
.preview-body pre { align-self: stretch; width: 100%; max-height: 70vh; overflow: auto; margin: 0; padding: .9rem 1rem; font: .8rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.preview-none { color: var(--muted); padding: 3rem 1rem; text-align: center; }
.pv-fs .preview-body img, .pv-fs .preview-body video { max-height: calc(100vh - 8rem); }
.pv-fs .preview-body iframe { height: calc(100vh - 8rem); }
.pv-fs .preview-body pre { max-height: calc(100vh - 8rem); }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border: 0; border-radius: 999px; background: color-mix(in srgb, #070a14 45%, transparent); color: #fff; cursor: pointer; transition: background .15s ease, opacity .15s ease; }
.pv-nav[hidden] { display: none; }
.pv-nav:hover { background: color-mix(in srgb, #070a14 65%, transparent); }
.pv-nav[disabled] { opacity: .25; cursor: default; }
.pv-nav svg { width: 1.05rem; height: 1.05rem; }
.pv-prev { left: .8rem; }
.pv-prev svg { transform: rotate(180deg); }
.pv-next { right: .8rem; }

/* 抽屉里的文件夹文件列表 */
.file-list { display: flex; flex-direction: column; gap: .1rem; margin: 0 0 1.2rem; padding: .4rem; max-height: 18rem; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.file-row { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem; border-radius: 8px; }
.file-row:hover { background: var(--surface); }
.file-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; color: var(--text); }
.file-row .name.canpv { cursor: pointer; }
.file-row .name.canpv:hover { color: var(--accent); text-decoration: underline; }
.file-row .size { font-size: .72rem; color: var(--subtle); }
.file-row .ops { display: flex; gap: .1rem; }
.file-row .ops a, .file-row .ops button { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.file-row .ops a:hover, .file-row .ops button:hover { background: var(--accent-soft); color: var(--accent); }
.file-row .ops svg { width: .95rem; height: .95rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
