:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-subtle: #f2f3f4;
  --border: #dfe1e4;
  --border-strong: #c9cdd2;
  --text: #1f2328;
  --muted: #66707b;
  --primary: #168a62;
  --primary-hover: #0f7351;
  --primary-soft: #e8f5ef;
  --warning: #b95000;
  --warning-soft: #fff1e7;
  --danger: #c52b31;
  --danger-soft: #fff0f0;
  --focus: #168a62;
  --shadow: 0 8px 24px rgba(31, 35, 40, .10);
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }

.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 480px) 1fr; background: var(--surface); }
.auth-panel { display: flex; flex-direction: column; padding: 40px 56px; border-right: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: white; background: var(--primary); font-size: 18px; font-weight: 800; }
.auth-form-wrap { width: 100%; max-width: 360px; margin: auto; }
.auth-form-wrap h1 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; }
.auth-form-wrap > p { color: var(--muted); margin: 0 0 26px; line-height: 1.55; }
.auth-aside { position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 64px; background: #1f2933; color: white; }
.auth-aside::before { content: ""; position: absolute; inset: 0; opacity: .8; background: linear-gradient(135deg, transparent 45%, rgba(22,138,98,.28) 45%, rgba(22,138,98,.28) 68%, transparent 68%), linear-gradient(35deg, #1f2933, #263c42); }
.auth-aside-copy { position: relative; max-width: 580px; }
.auth-aside h2 { margin: 0 0 14px; font-size: 34px; line-height: 1.2; }
.auth-aside p { margin: 0; color: #d8e0e4; font-size: 16px; line-height: 1.65; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 24px; }
.segmented button { min-height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.segmented button.active { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px rgba(31,35,40,.10); font-weight: 600; }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface); color: var(--text); }
.field input:hover, .field select:hover { border-color: #9da3aa; }
.field-hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.form-error { min-height: 20px; margin: 0 0 8px; color: var(--danger); font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 13px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-subtle); }
.btn.primary { border-color: var(--primary); background: var(--primary); color: white; font-weight: 600; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: #e8b7b9; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.full { width: 100%; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.icon-btn { width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 4px; display: inline-grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { border-color: var(--border); background: var(--surface-subtle); color: var(--text); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px 14px; border-right: 1px solid var(--border); background: var(--surface); z-index: 20; }
.sidebar .brand { padding: 0 8px 20px; }
.nav { display: grid; gap: 3px; }
.nav button { width: 100%; height: 38px; padding: 0 10px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 5px; background: transparent; color: #414a53; cursor: pointer; text-align: left; }
.nav button:hover { background: var(--surface-subtle); }
.nav button.active { color: #0d6849; background: var(--primary-soft); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 16px; }
.nav-separator { height: 1px; margin: 12px 8px; background: var(--border); }
.storage-meter { margin: auto 8px 14px; }
.storage-meter-row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.meter { height: 5px; overflow: hidden; border-radius: 3px; background: var(--surface-subtle); }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.meter-progress { width: 100%; height: 7px; border: 0; border-radius: 4px; overflow: hidden; background: var(--surface-subtle); }
.meter-progress::-webkit-progress-bar { background: var(--surface-subtle); }
.meter-progress::-webkit-progress-value { background: var(--primary); }
.meter-progress::-moz-progress-bar { background: var(--primary); }
.account { padding: 10px 8px 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: 32px minmax(0,1fr) 30px; gap: 9px; align-items: center; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #0c6548; background: var(--primary-soft); font-weight: 700; }
.avatar img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; }
.avatar.large { width: 72px; height: 72px; flex: 0 0 72px; font-size: 24px; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.account-role { color: var(--muted); font-size: 11px; margin-top: 2px; }

.main { min-width: 0; background: var(--surface); }
.topbar { height: 58px; padding: 0 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.96); position: sticky; top: 0; z-index: 15; }
.mobile-menu { display: none; }
.page-title { font-size: 15px; font-weight: 650; }
.topbar-spacer { flex: 1; }
.search { width: min(320px, 34vw); position: relative; }
.search input { width: 100%; height: 34px; padding: 6px 10px 6px 32px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); }
.search::before { content: "⌕"; position: absolute; left: 10px; top: 5px; color: var(--muted); font-size: 17px; }
.page { padding: 24px; max-width: 1500px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { margin: 0 0 5px; font-size: 21px; line-height: 1.25; }
.page-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.page-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

.toolbar { min-height: 46px; padding: 6px 9px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-bottom: 0; background: var(--surface-subtle); border-radius: 6px 6px 0 0; }
.breadcrumb { min-width: 0; display: flex; align-items: center; gap: 3px; overflow: hidden; }
.breadcrumb button { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 4px; }
.breadcrumb button:hover { background: var(--surface); color: var(--text); }
.breadcrumb span { color: #a0a6ad; }
.toolbar .spacer { flex: 1; }
.compact-select { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.compact-select select { height: 30px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); }
.view-switch { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.view-switch .icon-btn { width: 29px; height: 27px; }
.view-switch .icon-btn.active { color: var(--primary-hover); background: var(--primary-soft); }

.table-wrap { border: 1px solid var(--border); border-radius: 0 0 6px 6px; overflow-x: auto; }
.table-wrap.rounded { border-radius: 6px; }
.file-surface { position: relative; min-height: 180px; border: 1px solid var(--border); border-radius: 0 0 6px 6px; overflow: hidden; transition: border-color .15s, background .15s; }
.file-surface.rounded { border-radius: 6px; }
.file-surface.dragging { border-color: var(--primary); background: var(--primary-soft); }
.file-surface.dragging::after { content: "释放以上传文件"; position: absolute; inset: 12px; z-index: 5; display: grid; place-items: center; border: 2px dashed var(--primary); border-radius: 6px; color: var(--primary-hover); background: rgba(232,245,239,.94); font-weight: 700; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { height: 38px; padding: 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; border-bottom: 1px solid var(--border); background: #fafafa; }
td { height: 49px; padding: 7px 12px; border-bottom: 1px solid #eceef0; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfb; }
.name-cell { width: 44%; }
.size-cell { width: 130px; }
.date-cell { width: 180px; }
.action-cell { width: 286px; text-align: right; }
.select-cell { width: 42px; padding-left: 14px; padding-right: 4px; }
.select-cell input, .card-selector input { width: 16px; height: 16px; accent-color: var(--primary); }
.selected-row { background: var(--primary-soft); }
.file-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-name button { border: 0; padding: 0; background: transparent; color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.file-name button:hover { color: var(--primary-hover); text-decoration: underline; }
.file-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 5px; background: #edf1f4; color: #4e5965; font-size: 16px; }
.file-icon.folder { color: #8a5a00; background: #fff4d8; }
.file-icon.video { color: #1769aa; background: #e8f2fb; }
.file-icon.audio { color: #7b4aa8; background: #f2eafa; }
.file-icon.pdf { color: #ae2d35; background: #fcebed; font-size: 10px; font-weight: 800; }
.file-icon.markdown, .file-icon.text { color: #495968; background: #eef1f3; font-size: 12px; font-weight: 700; }
.file-thumb { width: 30px; height: 30px; flex: 0 0 30px; overflow: hidden; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-subtle); }
.file-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.file-thumb.large, .file-icon.large { width: 100%; height: 132px; border: 0; border-radius: 0; flex: 0 0 auto; font-size: 30px; }
.gallery .file-thumb.large, .gallery .file-icon.large { height: 210px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding: 12px; background: var(--bg); }
.gallery .file-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.file-card { min-width: 0; overflow: hidden; position: relative; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.file-card:hover { border-color: var(--border-strong); box-shadow: 0 3px 12px rgba(31,35,40,.08); }
.file-card.selected-card { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.card-selector { position: absolute; top: 8px; left: 8px; z-index: 3; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 5px; background: rgba(255,255,255,.94); }
.file-card-open { width: 100%; padding: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; border: 0; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.file-card-open > .large { grid-column: 1 / -1; }
.file-card-name { padding: 11px 8px 4px 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-card-meta { padding: 12px 11px 4px 4px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.file-card-actions { min-height: 38px; padding: 2px 7px 5px; display: flex; justify-content: flex-end; border-top: 1px solid #eef0f2; }
.batch-toolbar { min-height: 48px; padding: 7px 10px; display: flex; align-items: center; gap: 7px; border: 1px solid #9bcbb8; border-bottom: 0; background: var(--primary-soft); }
.batch-toolbar .spacer { flex: 1; }
.details-grid { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 10px 14px; margin: 0 0 22px; }
.details-grid dt { color: var(--muted); }
.details-grid dd { margin: 0; overflow-wrap: anywhere; }
.version-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.version-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.version-row { min-height: 48px; display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--border); }
.version-row > div { min-width: 0; margin-right: auto; display: grid; }
.version-row span { color: var(--muted); font-size: 11px; }
.icon-btn[href] { text-decoration: none; }
.muted { color: var(--muted); }
.empty { min-height: 300px; padding: 48px 24px; display: grid; place-items: center; text-align: center; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-subtle); color: var(--muted); font-size: 25px; }
.empty h3 { margin: 0 0 7px; font-size: 16px; }
.empty p { margin: 0; color: var(--muted); }

.band { border-top: 1px solid var(--border); padding: 22px 0; }
.band:first-of-type { border-top: 0; padding-top: 0; }
.band-header { display: grid; grid-template-columns: minmax(180px, 280px) minmax(0, 1fr); gap: 30px; }
.band h2 { margin: 0 0 6px; font-size: 15px; }
.band p { margin: 0; color: var(--muted); line-height: 1.5; }
.settings-form { max-width: 620px; }
.profile-settings { max-width: 680px; }
.avatar-editor { margin-bottom: 22px; padding-bottom: 18px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--border); }
.avatar-editor strong { display: block; margin-bottom: 9px; }
.usage-panel { max-width: 680px; }
.usage-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); border: 1px solid var(--border); border-radius: 6px; }
.usage-grid > div { min-width: 0; padding: 15px; display: grid; gap: 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.usage-grid > div:nth-child(3n) { border-right: 0; }
.usage-grid > div:nth-last-child(-n+3) { border-bottom: 0; }
.usage-grid strong { font-size: 16px; overflow-wrap: anywhere; }
.usage-grid span { color: var(--muted); font-size: 12px; }
.security-setting { max-width: 680px; display: flex; align-items: center; gap: 10px; }
.security-setting .btn { margin-left: auto; }
.session-list { max-width: 680px; border: 1px solid var(--border); border-radius: 6px; }
.session-record { min-height: 64px; padding: 10px 12px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto 32px; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.session-record:last-child { border-bottom: 0; }
.session-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 5px; background: var(--surface-subtle); color: var(--muted); }
.session-record p { margin-top: 3px; font-size: 12px; }
.setting-action { margin-top: 14px; }
.toggle-row { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-weight: 600; }
.toggle-row input { appearance: none; position: relative; width: 38px; height: 20px; min-height: 20px; padding: 0; flex: 0 0 38px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-subtle); cursor: pointer; }
.toggle-row input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.toggle-row input:checked { border-color: var(--primary); background: var(--primary); }
.toggle-row input:checked::after { background: white; transform: translateX(18px); }
.input-suffix { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface); }
.input-suffix input { min-width: 0; width: 100%; min-height: 36px; padding: 7px 9px; border: 0; background: transparent; color: var(--text); }
.input-suffix span { padding: 0 10px; color: var(--muted); }
.input-suffix.compact { width: 120px; }
.storage-inventory { max-width: 760px; display: grid; gap: 10px; }
.storage-record { padding: 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.storage-record.active { border-color: #78b8a0; box-shadow: inset 3px 0 0 var(--primary); }
.storage-record-head { display: flex; align-items: center; gap: 12px; }
.storage-record-head > div { min-width: 0; margin-right: auto; display: flex; align-items: center; gap: 9px; }
.storage-kind { padding: 3px 5px; border-radius: 4px; background: var(--surface-subtle); color: var(--muted); font: 700 10px/1.2 ui-monospace, monospace; }
.storage-record > p { margin: 9px 0 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-metrics { margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 12px; }
.storage-metrics strong { color: var(--text); }
.storage-settings { display: grid; gap: 12px; max-width: 680px; }
.storage-option { padding: 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.storage-option.selected { border-color: #87bda8; box-shadow: inset 3px 0 0 var(--primary); }
.storage-option > div:first-child { margin-bottom: 14px; }
.storage-option p { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.setting-status { margin-top: 10px !important; }
.checkbox-control { width: auto !important; min-height: 0 !important; }
.form-actions { display: flex; gap: 8px; }
.quota-input { width: 82px; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.status.active { color: #0c6849; background: var(--primary-soft); }
.status.disabled { color: var(--danger); background: var(--danger-soft); }
.status.warning { color: var(--warning); background: var(--warning-soft); }
.secret-box { padding: 14px; border: 1px solid #b7d9ca; border-radius: 6px; background: var(--primary-soft); }
.secret-value { margin: 10px 0; padding: 10px; border: 1px solid #a8cdbd; border-radius: 4px; background: white; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; padding: 20px; display: grid; place-items: center; background: rgba(20,25,30,.45); }
.modal { width: min(480px, 100%); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.modal-head { padding: 18px 20px 13px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 20px; }
.modal-actions { padding: 13px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); background: #fafafa; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast { padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 6px; background: #252a30; color: white; box-shadow: var(--shadow); line-height: 1.45; }
.toast.error { background: #8e2025; border-color: #8e2025; }
.upload-progress { position: fixed; right: 18px; bottom: 18px; z-index: 70; width: min(360px, calc(100vw - 36px)); padding: 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); }
.upload-progress-row { display: grid; grid-template-columns: minmax(0,1fr) auto 32px; align-items: center; gap: 10px; margin-bottom: 10px; }
.upload-progress-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress .meter { height: 7px; }
.load-more-row { padding: 16px 0 4px; display: flex; justify-content: center; }
.page-loading { min-height: 60vh; }
.share-loading { min-height: 120px; }
.confirmation-copy { margin: 0; line-height: 1.6; }

.viewer-backdrop { position: fixed; inset: 0; z-index: 120; padding: 18px; background: rgba(16,20,24,.82); }
.viewer { width: 100%; height: 100%; display: grid; grid-template-rows: 58px minmax(0,1fr); overflow: hidden; border: 1px solid #414850; border-radius: 7px; background: #111519; box-shadow: 0 16px 48px rgba(0,0,0,.35); }
.viewer-head { min-width: 0; padding: 0 14px 0 18px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #343a40; background: #1c2126; color: white; }
.viewer-head > div { min-width: 0; display: grid; gap: 2px; margin-right: auto; }
.viewer-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head span { color: #aeb7c0; font-size: 11px; }
.viewer-head .icon-btn { color: #d9e0e5; }
.viewer-head .icon-btn:hover { border-color: #4b535b; background: #2c3238; color: white; }
.viewer-body { min-width: 0; min-height: 0; display: grid; place-items: center; overflow: auto; background: #111519; }
.viewer-body .boot { min-height: 100%; }
.viewer-image { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-video { width: min(1200px, 100%); max-height: 100%; background: black; }
.viewer-pdf { width: 100%; height: 100%; border: 0; background: white; }
.viewer-text { width: min(1100px, calc(100% - 36px)); min-height: calc(100% - 36px); margin: 18px; padding: 22px; overflow: auto; border: 1px solid #343b42; border-radius: 6px; background: #181d22; color: #e6edf3; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.viewer-text.document { max-width: 900px; background: white; color: #252a30; font: 15px/1.75 system-ui, sans-serif; }
.archive-list { width: min(900px, calc(100% - 36px)); max-height: calc(100% - 36px); overflow: auto; border: 1px solid #343b42; border-radius: 6px; background: #181d22; color: #e6edf3; }
.archive-summary { padding: 13px 16px; color: #aeb7c0; border-bottom: 1px solid #343b42; }
.archive-entry { min-height: 42px; padding: 8px 14px; display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items: center; gap: 8px; border-bottom: 1px solid #2b3137; }
.archive-entry strong { overflow-wrap: anywhere; font-weight: 500; }
.audio-viewer { width: min(520px, calc(100% - 32px)); padding: 32px; display: grid; gap: 20px; justify-items: center; border: 1px solid #343b42; border-radius: 7px; color: white; background: #1b2025; }
.audio-art { width: 120px; height: 120px; display: grid; place-items: center; border-radius: 6px; background: #2b343d; color: #b7ddcf; font-size: 52px; }
.audio-viewer audio { width: 100%; }

.share-shell { min-height: 100vh; background: var(--bg); }
.share-top { height: 60px; padding: 0 24px; display: flex; align-items: center; border-bottom: 1px solid var(--border); background: var(--surface); }
.share-main { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px; }
.share-tool { width: min(760px, 100%); border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.share-file { padding: 28px; text-align: center; border-bottom: 1px solid var(--border); }
.share-file .file-icon { margin: 0 auto 14px; width: 48px; height: 48px; font-size: 23px; }
.share-file h1 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.share-controls { padding: 20px; }
.public-download p { margin: 0 0 16px; color: var(--muted); text-align: center; }
.public-share-toolbar { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.public-share-toolbar .breadcrumb { margin-right: auto; }
.public-file-list { display: grid; }
.public-file-list > a, .public-file-list > button { min-width: 0; min-height: 52px; padding: 8px 4px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-decoration: none; text-align: left; cursor: pointer; }
.public-file-list > a:hover, .public-file-list > button:hover { background: var(--surface-subtle); }
.public-file-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-file-list > * > span:last-child { color: var(--muted); }
.public-empty { padding: 24px 0; text-align: center; }

body.density-compact .page { padding-top: 16px; }
body.density-compact td { height: 40px; padding-top: 4px; padding-bottom: 4px; }
body.density-compact .file-card-actions { min-height: 32px; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151719;
  --surface: #1d2023;
  --surface-subtle: #262a2e;
  --border: #353a3f;
  --border-strong: #4a5158;
  --text: #eef1f3;
  --muted: #a2abb4;
  --primary: #2aa876;
  --primary-hover: #4fc18f;
  --primary-soft: #17382c;
  --danger-soft: #3b2022;
  --warning-soft: #3a2b1e;
  --shadow: 0 8px 24px rgba(0,0,0,.32);
}
:root[data-theme="dark"] .topbar { background: rgba(29,32,35,.96); }
:root[data-theme="dark"] th, :root[data-theme="dark"] .modal-actions { background: #222629; }
:root[data-theme="dark"] td { border-bottom-color: #30353a; }
:root[data-theme="dark"] tbody tr:hover { background: #23272a; }
:root[data-theme="dark"] .file-icon { background: #2c3237; color: #c6ced5; }
:root[data-theme="dark"] .file-icon.folder { background: #40351e; color: #f0c96c; }
:root[data-theme="dark"] .card-selector { background: rgba(29,32,35,.94); }
:root[data-theme="dark"] .secret-value { background: #202428; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #151719; --surface: #1d2023; --surface-subtle: #262a2e; --border: #353a3f; --border-strong: #4a5158;
    --text: #eef1f3; --muted: #a2abb4; --primary: #2aa876; --primary-hover: #4fc18f; --primary-soft: #17382c;
    --danger-soft: #3b2022; --warning-soft: #3a2b1e; --shadow: 0 8px 24px rgba(0,0,0,.32);
  }
  :root[data-theme="system"] .topbar { background: rgba(29,32,35,.96); }
  :root[data-theme="system"] th, :root[data-theme="system"] .modal-actions { background: #222629; }
  :root[data-theme="system"] td { border-bottom-color: #30353a; }
  :root[data-theme="system"] tbody tr:hover { background: #23272a; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-panel { min-height: 100vh; border-right: 0; padding: 28px 24px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: 230px; transition: transform .18s ease; box-shadow: var(--shadow); }
	.sidebar:not(.open) { visibility: hidden; transform: translateX(calc(-100% - 24px)); }
  .sidebar.open { visibility: visible; transform: translateX(0); }
  .mobile-menu { display: inline-grid; }
  .topbar { padding: 0 14px; }
  .page { padding: 18px 14px; }
  .search { width: min(230px, 40vw); }
  .band-header { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 620px) {
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-actions { margin-left: 0; }
  .page-actions .btn { flex: 1 1 120px; }
  .search { display: none; }
  .toolbar { overflow-x: auto; }
  .size-cell, .date-cell { display: none; }
  .name-cell { width: auto; }
  .action-cell { width: 196px; }
	.select-cell { width: 34px; }
	.batch-toolbar { overflow-x: auto; }
	.batch-toolbar strong { white-space: nowrap; }
	.public-share-toolbar { align-items: stretch; flex-direction: column; }
  td, th { padding-left: 9px; padding-right: 9px; }
  .inline-fields { grid-template-columns: 1fr; gap: 0; }
	.usage-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
	.usage-grid > div, .usage-grid > div:nth-child(3n), .usage-grid > div:nth-last-child(-n+3) { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
	.usage-grid > div:nth-child(2n) { border-right: 0; }
	.usage-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
	.session-record { grid-template-columns: 38px minmax(0,1fr) 32px; }
	.session-record .status { grid-column: 2; width: max-content; }
	.user-table { overflow: visible; }
	.user-table table, .user-table tbody, .user-table tr, .user-table td { display: block; width: 100%; }
	.user-table thead { display: none; }
	.user-table tr { padding: 10px; border-bottom: 1px solid var(--border); }
	.user-table tr:last-child { border-bottom: 0; }
	.user-table td { height: auto; padding: 6px 2px; border: 0; }
	.user-table td:nth-child(2)::before, .user-table td:nth-child(3)::before, .user-table td:nth-child(4)::before { display: inline-block; width: 52px; color: var(--muted); font-size: 12px; }
	.user-table td:nth-child(2)::before { content: "角色"; }
	.user-table td:nth-child(3)::before { content: "状态"; }
	.user-table td:nth-child(4)::before { content: "配额"; vertical-align: top; padding-top: 9px; }
	.user-table td:nth-child(4) .input-suffix { display: inline-grid; }
	.user-table .action-cell { display: flex; width: auto; gap: 8px; text-align: left; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 7px 7px 0 0; }
  .toolbar .compact-select span, .toolbar .item-count { display: none; }
  .file-grid, .gallery .file-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 8px; }
  .file-thumb.large, .file-icon.large, .gallery .file-thumb.large, .gallery .file-icon.large { height: 112px; }
	.file-card-actions .icon-btn { width: 28px; }
	.action-cell [data-copy], .action-cell [data-rename], .action-cell [data-extract] { display: none; }
  .viewer-backdrop { padding: 0; }
  .viewer { border: 0; border-radius: 0; }
  .viewer-text { width: calc(100% - 20px); min-height: calc(100% - 20px); margin: 10px; padding: 14px; }
}
