/* 全局样式 - Element UI 风格 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Keep mobile orientation changes from inflating text; preserve user zoom. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.clipboard-scroll-stable {
  overflow-anchor: none;
}

:root {
  --primary: #111111;
  --primary-light: #333333;
  --primary-dark: #000000;
  --success: #4A7D46;
  --warning: #A17A2E;
  --danger: #B3261E;
  --info: #5D5B56;
  --text-primary: #171717;
  --text-regular: #3D3D3D;
  --text-secondary: #5D5B56;
  --border-base: #D8D7D2;
  --border-light: #E4E1D9;
  --background: #F8F7F3;
  --background-white: #FFFFFA;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --glass-bg: rgba(255, 255, 250, 0.85);
  --glass-blur: blur(12px) saturate(1.2);
  --accent-soft: rgba(17, 17, 17, 0.06);
  --accent-focus: rgba(17, 17, 17, 0.1);
  --login-gradient: linear-gradient(135deg, #111111 0%, #3D3D3D 100%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--background);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 登录页 */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--login-gradient);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.18);
}

.login-title {
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 13px;
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 15px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
}

.form-input.error {
  border-color: var(--danger);
}

.form-group {
  margin-bottom: 16px;
}

.form-group .form-input + .form-input {
  margin-top: 16px;
}

#loginForm .form-group {
  margin-bottom: 0;
}

.form-group + .btn {
  margin-top: 24px;
}

.error-msg {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  min-height: 18px;
}

.error-msg:empty {
  display: none;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0 16px;
  border: 1px solid var(--border-base);
  background: white;
  color: var(--text-regular);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.18s ease;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn:hover {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--border-light);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: white;
}

.btn-danger {
  color: var(--danger);
  border-color: #E2C1BE;
  background: #F9ECEB;
}

.btn-danger:hover {
  color: white;
  background: var(--danger);
  border-color: var(--danger);
}

.btn-text {
  border: none;
  background: transparent;
  color: var(--primary);
  padding: 0 8px;
  height: auto;
}

.btn-text:hover {
  background: transparent;
  color: var(--primary-light);
}

.btn-text.danger {
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-regular);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  flex: 0 0 auto;
}
.icon-btn svg { display: block; }
.icon-btn:hover,
.icon-btn:focus-visible { color: var(--primary); background: var(--border-light); outline: none; }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover,
.icon-btn.danger:focus-visible { color: white; background: var(--danger); }
.badge-btn { position: relative; }
.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 600;
}

.btn:disabled,
.icon-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 头部 */
.header {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
}

.header-action-menu {
  display: none;
}
.header-action-mask { display: none; }

/* 桌面端：操作按钮内联显示 */
.header-actions-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-action-icon { width:16px; height:16px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.header-actions-inline .icon-btn { width:32px; height:32px; padding:0; }
.header-actions-inline #logoutBtn:hover { color:var(--danger); }
.header-action-menu .btn { gap:12px; }
.header-actions-inline .btn {
  height: 32px;
  padding: 0 12px;
}
.header-menu-button { display: none; }

.storage-info {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.storage-bar {
  width: 100px;
  height: 6px;
  background: var(--background);
  border-radius: 3px;
  overflow: hidden;
}

.storage-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s, background 0.3s;
}

.storage-bar-fill.warn { background: var(--warning); }
.storage-bar-fill.danger { background: var(--danger); }

/* 主容器 */
.main {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 12px 12px 12px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* 预留滚动条空间，避免不同 tab 因有无滚动条导致宽度跳变 */
  scrollbar-gutter: stable;
}

/* 上传区 */
.upload-zone {
  background: white;
  border: 2px dashed var(--border-base);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s ease;
  margin-bottom: 16px;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--border-light);
}

.upload-zone.compact {
  padding: 16px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 16px;
}

.upload-icon {
  font-size: 48px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.upload-text {
  font-size: 14px;
  color: var(--text-regular);
}

.upload-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* 工具栏 */
.toolbar {
  background: white;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.filter-group {
  display: inline-flex;
  padding: 2px;
  gap: 0;
  align-items: center;
  background: var(--background);
  border-radius: var(--radius);
}

.filter-btn {
  height: 24px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-regular);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

@media (pointer: fine) {
  .filter-btn:hover {
    color: var(--primary);
  }
}

.filter-btn.active {
  background: var(--background-white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-wrap svg.search-icon {
  position: absolute;
  left: 9px;
  color: var(--text-muted, #aaa);
  pointer-events: none;
  flex-shrink: 0;
}
.search-wrap .file-search {
  padding-left: 30px;
}
.file-search {
  width: 210px;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  color: var(--text-primary);
  background: white;
}

.file-search::placeholder { color: var(--text-muted, #aaa); }

.file-search:focus { outline: none; border-color: var(--primary); box-shadow: none; }
.search-wrap .file-search { margin: 0; padding-right: 30px; line-height: normal; }
.file-search::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-clear { position:absolute; right:3px; top:50%; transform:translateY(-50%); display:grid; place-items:center; width:26px; height:26px; padding:0; border:0; background:transparent; color:var(--text-secondary); cursor:pointer; }
.search-clear[hidden] { display:none; }
.search-clear svg { width:14px; height:14px; }
#filesTab .toolbar-right,#clipboardTab .toolbar-right ,#shareTab .toolbar-right { align-items:center; }
#filesTab .toolbar-right>.search-wrap,#clipboardTab .toolbar-right>.search-wrap ,#shareTab .toolbar-right>.search-wrap { height:32px; align-self:center; margin:0; }
#filesTab .toolbar-right>.file-count,#clipboardTab .toolbar-right>.file-count ,#shareTab .toolbar-right>.file-count { display:flex; align-items:center; height:32px; line-height:1; margin:0; }
.mobile-files-toggle { align-items:center; justify-items:center; }

.file-sort-heading { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.file-header .text-center { justify-content: center; text-align: center; }
.file-sort { width: 22px; height: 22px; display: inline-grid; place-items: center; flex: 0 0 22px; border: 0; padding: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
.file-sort:hover, .file-sort:focus-visible { color: var(--primary); outline: none; }
.sort-icon { width: 15px; height: 15px; }
.sort-icon .sort-up-active, .sort-icon .sort-down-active { stroke: #000; stroke-width: 2.2; }

.file-count {
  color: var(--text-secondary);
  font-size: 13px;
}

/* 文件列表 */
.file-list {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.file-header,
.file-row {
  display: grid;
  grid-template-columns: 28px 34px minmax(0,1fr) 120px 125px 72px 104px;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.file-header {
  background: var(--background);
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.file-row {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

.file-row:hover {
  background: var(--background);
}

.file-row:last-child {
  border-bottom: none;
}

.file-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.file-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 600;
  overflow: hidden;
  background: var(--info);
}

.file-icon.image {
  background: transparent;
  padding: 0;
}

.file-icon.video-poster {
  background: #111;
}

.file-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}

.file-icon .file-ext {
  font-size: 9px;
  text-transform: uppercase;
  color: white;
  letter-spacing: 0.2px;
}

.file-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-all;
  overflow: hidden;
  touch-action: manipulation;
}
.file-name-previewable {
  cursor: pointer;
  color: var(--text-primary);
  transition: color 0.15s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.file-name-previewable:hover,
.file-name-previewable:focus-visible {
  color: var(--primary);
  outline: none;
}

.file-size,
.file-time,
.file-device {
  font-size: 13px;
  color: var(--text-secondary);
}

.file-device {
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}

.admin-file-header, .admin-file-row {
  display: grid;
  grid-template-columns: minmax(220px,1.45fr) minmax(180px,1fr) 72px 92px 150px minmax(170px,.9fr);
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
}
.admin-file-header { background:var(--background); border-bottom:1px solid var(--border-light); color:var(--text-secondary); font-size:13px; font-weight:500; }
.admin-file-header button { border:0; padding:0; background:transparent; color:inherit; font:inherit; text-align:left; cursor:pointer; }
.admin-file-header button:hover { color:var(--primary); }
.admin-file-row { border-bottom:1px solid var(--border-light); font-size:13px; color:var(--text-secondary); }
.admin-file-row:hover { background:var(--background); }
.admin-file-name { display:flex; align-items:center; min-width:0; gap:10px; color:var(--text-primary); font-weight:500; }
.admin-file-name > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.admin-file-icon { width:40px; height:40px; flex:0 0 40px; display:flex; align-items:center; justify-content:center; border-radius:var(--radius); background:var(--info); color:#fff; font-size:10px; font-style:normal; overflow:hidden; }
.admin-file-icon img { width:100%; height:100%; object-fit:cover; }
@media (max-width: 900px) { .admin-file-header,.admin-file-row{grid-template-columns:minmax(180px,1fr) 150px 72px 92px 150px}.admin-file-header>div:nth-child(2),.admin-file-row>div:nth-child(2){display:none} }
@media (max-width: 640px) { .toolbar{flex-wrap:wrap}.toolbar .toolbar-right{flex-basis:100%;justify-content:space-between;flex-wrap:nowrap}.toolbar .search-wrap{flex:1 1 auto;min-width:0}.toolbar .search-wrap .file-search{width:100%}.admin-file-header,.admin-file-row{grid-template-columns:minmax(150px,1fr) 72px 1fr}.admin-file-header>div:nth-child(3),.admin-file-row>div:nth-child(3),.admin-file-header>button,.admin-file-row>div:nth-child(4),.admin-file-row>div:nth-child(5){display:none}.admin-file-row{padding:10px}.admin-file-header{padding:10px}.admin-file-row .file-actions{flex-wrap:wrap}}

/* 空状态 */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* 上传进度列表 */
.upload-progress-list {
  background: white;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.upload-progress-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.upload-progress-item:last-child {
  border-bottom: none;
}

.upload-progress-name {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-bar {
  width: 200px;
  height: 6px;
  background: var(--background);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.2s;
}

.upload-progress-bar-fill.error {
  background: var(--danger);
}

.upload-progress-percent {
  width: 50px;
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
}

.upload-progress-error {
  display: none;
  flex-basis: 100%;
  padding-left: calc(100% - 262px);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .upload-progress-bar { width: 110px; }
  .upload-progress-error { padding-left: 0; }
}

/* Toast 消息 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.3s;
  max-width: 80%;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast.warning { background: var(--warning); }

@keyframes slideDown {
  from { transform: translate(-50%, -100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 20px;
}

.modal-mask.active {
  display: flex;
}

.modal {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.16);
}

#confirmModal, #adminConfirmModal { z-index: 10000; }

.confirm-dialog { max-width: 360px; }
.confirm-dialog .modal-header { border-bottom: 0; padding-bottom: 8px; }
.confirm-dialog .modal-body { padding: 8px 20px 16px; color: var(--text-regular); line-height: 1.6; }
.confirm-dialog .modal-footer { border-top: 0; padding-top: 0; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  background: none;
  border: none;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 响应式 */
@media (max-width: 1000px) {
  .file-header,
  .file-row {
    grid-template-columns: 28px 34px minmax(0,1fr) 125px 72px 104px;
  }
  .file-device { display: none; }
  .file-header .col-device { display: none; }
}

@media (max-width: 700px) {
  .file-header,
  .file-row {
    grid-template-columns: 28px 34px minmax(0,1fr) 104px;
  }
  .file-time { display: none; }
  .file-header .col-time { display: none; }
  .file-size { display: none; }
  .file-header .col-size { display: none; }
  .header-actions { gap: 8px; }
  .header-actions-inline { display: none; }
  .header-menu-button { display: grid; }
  .header-action-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 129;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }
  .header-action-mask.open { opacity: 1; pointer-events: auto; }
  .header-action-menu {
    position: fixed;
    top: 60px;
    right: 12px;
    z-index: 130;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 176px;
    padding: 10px;
    background: #FFFFFA;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, .2);
    transform: translateY(-6px);
    opacity: 0;
    pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
  }
  .header-action-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .header-action-menu .btn {
    width: 100%;
    justify-content: flex-start;
    height: 44px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    border-radius: var(--radius);
    transition: background .15s ease;
  }
  .header-action-menu .btn:hover { background: var(--border-light); }
  .header-action-menu .btn:active { background: var(--border-light); }
  .header-action-menu #logoutBtn { color: var(--danger); }
}

@media (max-width: 500px) {
  .file-header,
  .file-row {
    grid-template-columns: 28px 34px minmax(0,1fr) 104px;
  }
  .file-icon-col { display: block; }
  .file-header .col-icon { display: block; }
  .header { padding: 12px 16px; }
  .main { padding: 0 12px 12px 12px; }
  .storage-info .storage-bar { display: none; }
  .storage-info .storage-text { display: block; }
  .file-search { width: 150px; }
  .file-actions { gap: 4px; }
}

/* 加载动画 */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

/* 标签页 */
.tabs {
  display: flex;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-base);
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--background);
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 640px) {
  .tab-btn { flex: 1; padding: 10px 6px; font-size: 13px; }
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* .main 为 flex column 提供高度链时，普通子项不参与 flex 拉伸，行为等同 block */
.main > .tabs,
.main > .tab-content {
  flex: none;
  width: 100%;
}

.canvas-list-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px;flex-wrap:wrap}.canvas-list-mode{display:flex;gap:8px}.canvas-sort{width:auto;min-width:130px}.canvas-list-toolbar .file-search,.canvas-list-toolbar .canvas-sort,.canvas-list-toolbar .btn-sm{height:32px;min-height:32px}.canvas-status{min-height:24px;color:var(--text-secondary);font-size:14px}.canvas-card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:18px}.canvas-card{min-width:0;background:var(--glass-bg);backdrop-filter:var(--glass-blur);-webkit-backdrop-filter:var(--glass-blur);border:1px solid var(--border-base);border-radius:16px;overflow:hidden;box-shadow:var(--shadow-sm);transition:transform .16s ease,box-shadow .16s ease}.canvas-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-md)}.canvas-preview{display:flex;width:100%;height:156px;border:0;border-bottom:1px solid var(--border-light);background:var(--background);align-items:center;justify-content:center;cursor:pointer;padding:0}.canvas-preview img{width:100%;height:100%;object-fit:cover}.canvas-preview-placeholder{color:var(--text-secondary);font-size:14px}.canvas-card-body{min-width:0;padding:14px}.canvas-card-title{font-size:16px;font-weight:650;color:var(--text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.canvas-card-meta-row{display:flex;align-items:flex-end;justify-content:space-between;gap:8px;margin-top:7px}.canvas-card-meta-list{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:5px 8px;flex-wrap:wrap;font-size:12px;color:var(--text-secondary)}.canvas-card-meta-list span,.canvas-card-meta-list time{min-width:0;white-space:nowrap}.canvas-card-meta-list span:first-child{max-width:100%;overflow:hidden;text-overflow:ellipsis}.canvas-card-meta-list>*:not(:last-child)::after{content:'·';margin-left:8px;color:var(--border-base)}.canvas-sync-state{color:var(--success)}.canvas-card-actions{flex:0 0 auto;display:flex;justify-content:flex-end;gap:7px;flex-wrap:wrap}
/* 28px 按钮盒内 15px 图标垂直居中导致视觉偏高，整个按钮连同 hover 背景下移对齐 */
.canvas-card-actions .icon-btn{transform:translateY(5px)}.canvas-empty{grid-column:1/-1;min-height:260px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;border:1px dashed var(--border-base);border-radius:16px;color:var(--text-secondary)}.canvas-empty-icon{font-size:40px;color:var(--text-secondary)}.canvas-device-row{padding:12px 0;border-bottom:1px solid var(--border-light)}.canvas-device-row:last-child{border:0}.canvas-device-row>div{display:flex;justify-content:space-between;gap:10px}.canvas-device-row span,.canvas-device-row small{color:var(--text-secondary)}.canvas-device-row small{display:block;margin-top:5px}
@media(max-width:760px){.canvas-list-toolbar{flex-wrap:wrap}.canvas-list-toolbar .toolbar-right{flex-basis:100%;justify-content:space-between;flex-wrap:nowrap}.canvas-list-toolbar .search-wrap{flex:1 1 auto;min-width:0}.canvas-list-toolbar .search-wrap .file-search{width:100%}.canvas-card-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.canvas-preview{height:112px}.canvas-card-body{padding:10px}.canvas-sort{width:auto}}
@media(max-width:520px){.canvas-card-grid{grid-template-columns:1fr}.canvas-card{display:grid;grid-template-columns:96px minmax(0,1fr)}.canvas-preview{height:100%;border-right:1px solid var(--border-light);border-bottom:0}.canvas-card-actions{justify-content:flex-end}.canvas-empty{min-height:220px;padding:20px;text-align:center}}

#clipboardClearAllBtn { align-items: center; justify-content: center; }
@media(max-width:460px){.canvas-card-grid{grid-template-columns:1fr}}

/* 剪贴板区域 */
.clipboard-input-area {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.clipboard-input-area textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  min-height: 120px; /* 与文件上传虚线框默认高度对齐（整体约164px），作为最小高度，内容增高时自动扩展 */
  resize: none; /* 高度由内容驱动，禁用手动拉伸 */
  overflow-y: auto; /* 自动增高为主，极端长内容仍可滚动 */
  outline: none;
  transition: border-color 0.2s;
}

.clipboard-input-area textarea:focus {
  border-color: var(--primary);
}

.clipboard-input-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.clipboard-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
}

.clipboard-count.danger {
  color: var(--danger);
}

.clipboard-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.clipboard-list-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.clipboard-list {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}


.clipboard-item {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.2s;
}

.clipboard-item:last-child {
  border-bottom: none;
}

.clipboard-item:hover {
  background-color: var(--background);
}

.clipboard-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.clipboard-device {
  font-size: 12px;
  color: var(--primary);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 0;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clipboard-time {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}

.clipboard-format-toggle {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.clipboard-format-toggle:hover {
  color: var(--primary);
}

.clipboard-format-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.clipboard-format-toggle:disabled {
  opacity: 0.45;
  cursor: default;
}

.clipboard-length {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .clipboard-item-header { gap: 6px; }
  .clipboard-device { max-width: 34%; }
}

.clipboard-content {
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.6;
  white-space: pre-wrap;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 12px;
}

.clipboard-content.markdown-content {
  white-space: normal;
  word-break: break-word;
}

.markdown-content > :first-child {
  margin-top: 0;
}

.markdown-content > :last-child {
  margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 0.9em 0 0.45em;
  line-height: 1.35;
}

.markdown-content h1 { font-size: 1.45em; }
.markdown-content h2 { font-size: 1.3em; }
.markdown-content h3 { font-size: 1.16em; }
.markdown-content p { margin: 0.6em 0; }
.markdown-content ul,
.markdown-content ol { margin: 0.6em 0; padding-left: 1.6em; }
.markdown-content blockquote { margin: 0.7em 0; padding-left: 0.9em; border-left: 3px solid var(--border); color: var(--text-secondary); }
.markdown-content pre { margin: 0.7em 0; padding: 10px 12px; overflow-x: auto; border-radius: 4px; background: rgba(0, 0, 0, 0.045); }
.markdown-content code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.markdown-content :not(pre) > code { padding: 1px 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.045); }
.markdown-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.markdown-content th,
.markdown-content td { padding: 5px 8px; border: 1px solid var(--border-light); text-align: left; }
.markdown-content a { color: var(--primary); }

.clipboard-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.clipboard-actions .btn {
  font-size: 12px;
  padding: 4px 12px;
}

.clipboard-image-preview {
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: var(--background);
  max-width: 320px;
  cursor: pointer;
}

.clipboard-image-preview img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.clipboard-item.image-item {
  background: linear-gradient(to right, var(--accent-soft), transparent);
}

.clipboard-item.image-item:hover {
  background: linear-gradient(to right, var(--accent-focus), var(--background));
}

/* HTML 预览弹窗 */
.preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.preview-modal.active {
  display: flex;
}

.preview-box {
  background: var(--background-white);
  width: 90%;
  height: 90%;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--background);
}

.preview-title {
  font-weight: 500;
  color: var(--text-primary);
}

.preview-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
}

.preview-close:hover {
  color: var(--text-primary);
}

.preview-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: var(--background-white);
}

.preview-frame {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.preview-image-container {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--background);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

/* 查看器组件 */
.viewer-stage {
  position: absolute;
  inset: 40px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  background: var(--background);
}

.viewer-box {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 0 0;
  will-change: transform;
}

.viewer-stage .viewer-content {
  max-width: none;
  max-height: none;
  display: block;
  transform-origin: center center;
  transition: none;
}

.office-preview-fallback {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
}

.office-preview-fallback strong { color: var(--text-primary); font-size: 16px; }
.office-preview-fallback span { color: var(--text-tertiary); font-size: 13px; }
.office-preview-fallback .btn { margin-top: 8px; }

.video-preview-notice {
  position: absolute;
  left: 50%;
  top: 10px;
  z-index: 4;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(20, 20, 20, .72);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: auto;
}
.video-preview-notice a { color: #fff; text-decoration: underline; }
.video-preview-error { background: rgba(139, 31, 31, .84); }
@media (max-width: 640px) {
  .video-preview-notice { top: 8px; white-space: normal; text-align: center; }
}

.viewer-toolbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid var(--border-light);
  z-index: 10;
  border-radius: 8px 8px 0 0;
}

.viewer-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-base);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-regular);
  transition: all 0.15s;
  user-select: none;
  line-height: 1;
}

.viewer-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--border-light);
}

.viewer-level {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.btn-secondary {
  background: var(--info);
  color: #fff;
}

.btn-secondary:hover {
  background: #6B7280;
}

/* 钉钉帮助弹窗 */
.help-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  background: var(--background);
}

.help-tab {
  flex: 1;
  padding: 14px 0;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-weight: 500;
}

.help-tab:hover {
  color: var(--primary);
  background: var(--accent-soft);
}

.help-tab.active {
  color: var(--primary);
  background: white;
}

.help-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.help-content {
  display: none;
  padding: 16px 20px;
}

.help-content.active {
  display: block;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.help-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--background);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border-light);
}

.help-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

.help-table tbody tr:hover {
  background: #fafbfc;
}

.help-table tbody tr:last-child {
  border-bottom: none;
}

.help-table tbody td {
  padding: 11px 10px;
  color: var(--text-regular);
  vertical-align: top;
  line-height: 1.6;
}

.help-table tbody td:first-child {
  font-weight: 500;
  color: var(--text-primary);
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
  letter-spacing: 0.3px;
}

.tag-blue {
  background: var(--accent-soft);
  color: var(--primary);
}

.tag-green {
  background: rgba(74, 125, 70, 0.1);
  color: var(--success);
}

.tag-purple {
  background: var(--accent-soft);
  color: var(--primary);
}

.tag-orange {
  background: rgba(161, 122, 46, 0.1);
  color: var(--warning);
}

.tag-red {
  background: rgba(179, 38, 30, 0.1);
  color: var(--danger);
}

/* 操作日志 */
.log-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.log-row:last-child {
  border-bottom: none;
}

.log-row:first-child {
  padding-top: 0;
}

.log-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
}

.log-file {
  color: var(--text-regular);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-meta {
  margin-top: 4px;
  padding-left: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.log-ip {
  margin-left: 12px;
  color: var(--text-secondary);
  opacity: 0.8;
}

.log-device {
  margin-left: 12px;
  color: var(--text-secondary);
  opacity: 0.8;
}

.log-code {
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--border-light);
  border-radius: 4px;
  padding: 1px 6px;
}

.log-empty {
  padding: 24px 0;
  text-align: center;
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-secondary);
  font-size: 12px;
}

.help-footer {
  padding: 12px 20px;
  background: var(--background);
  border-top: 1px solid var(--border-light);
}

.help-tip {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-tip::before {
  content: '💡';
  font-size: 14px;
}

.push-settings {
  padding: 16px 20px;
}

.bind-card p {
  margin: 0 0 12px;
}

.bind-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bind-status-badge {
  background: rgba(34, 197, 94, .12);
  color: #16a34a;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

.bind-steps {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
}

.bind-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.7;
  padding: 8px 0;
}

.bind-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-on-primary, #fff);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.bind-card code {
  background: var(--background);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.bind-code-box {
  display: inline-block;
  margin: 12px 0 8px;
  padding: 10px 18px;
  font-family: Consolas, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--text-strong);
  background: var(--background);
  border: 1px dashed var(--divider);
  border-radius: var(--radius);
}

.bind-staff-id {
  margin: 12px 0;
  font-family: Consolas, monospace;
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
}

.push-variables {
  background: var(--background);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.push-variables-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-regular);
  margin-bottom: 8px;
}

.push-variables-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.var-item {
  font-size: 12px;
  color: var(--text-secondary);
}

.var-item code {
  background: var(--accent-soft);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: inherit;
}

.push-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.push-item:last-of-type {
  border-bottom: none;
}

.push-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.push-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.push-item-header .text-muted {
  flex: 1;
  min-width: 0;
}

.push-item-header .push-test-btn {
  flex-shrink: 0;
  margin-left: auto;
}

.push-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}

.push-textarea:focus {
  border-color: var(--primary);
}

.push-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.push-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.push-slider {
  width: 38px;
  height: 22px;
  background: var(--border-base);
  border-radius: 999px;
  position: relative;
  transition: background .15s ease;
}

.push-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform .15s ease;
  box-shadow: var(--shadow-sm);
}

.push-switch input:checked + .push-slider {
  background: var(--primary);
}

.push-switch input:checked + .push-slider::before {
  transform: translateX(16px);
}

.push-switch input:focus-visible + .push-slider { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.push-switch input:disabled + .push-slider { opacity: .55; cursor: wait; }

.push-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.tag-info {
  background: rgba(107, 114, 128, 0.1);
  color: var(--info);
}

.dingtalk-modal {
  max-width: 720px;
  width: min(720px, calc(100vw - 40px));
  height: calc(100vh - 80px);
  max-height: 680px;
}

.dingtalk-body {
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dingtalk-body .help-tabs {
  flex-shrink: 0;
}

.dingtalk-body .help-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.dingtalk-body .help-footer {
  flex-shrink: 0;
}

/* 分享弹窗 */
.share-info {
  text-align: center;
  margin-bottom: 20px;
}

.share-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.share-desc {
  color: var(--text-regular);
  font-size: 14px;
}

/* 与分享访问密码页面的锁图标同款：浅灰圆底 + 中性图标色 */
.share-icon-check {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #F1F0EC;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5D5B56;
}

.share-url-box {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 16px;
}

.share-url-link {
  flex: 1;
  min-width: 0;
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border-base);
  border-radius: 0;
  font-size: 13px;
  background: var(--background);
  color: #2563eb;
  text-decoration: underline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-url-link:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.share-url-box .btn-sm {
  height: 38px;
  flex-shrink: 0;
}

.share-success-context {
  margin: -4px 0 14px;
  text-align: center;
}
.share-success-title { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }

.share-tip {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.share-expire {
  margin-bottom: 16px;
}

.share-expire-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-regular);
  margin-bottom: 10px;
}

.share-expire-options {
  display: flex;
  gap: 8px;
}

.share-expire-option {
  flex: 1;
  cursor: pointer;
}

.share-expire-option input {
  display: none;
}

.share-expire-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  text-align: center;
  padding: 0;
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-regular);
  transition: all 0.2s;
}

.share-expire-option input:checked + span {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.share-password {
  margin-bottom: 16px;
}

.share-download-permission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--background);
  border-radius: var(--radius);
}
.share-download-permission-manage { margin-bottom: 12px; }
.share-download-permission-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.share-download-permission-help { margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--text-secondary); }
.share-switch { position: relative; display: inline-flex; flex: 0 0 auto; cursor: pointer; }
.share-switch input { position: absolute; opacity: 0; pointer-events: none; }
.share-switch span { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--border-base); transition: background .15s ease; }
.share-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm); transition: transform .15s ease; }
.share-switch input:checked + span { background: var(--primary); }
.share-switch input:checked + span::after { transform: translateX(16px); }
.share-switch input:focus-visible + span { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.share-switch input:disabled + span { opacity: .55; cursor: wait; }

.share-password-input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--background-white);
  color: var(--text-primary);
  outline: none;
}

.share-password-input:focus {
  border-color: var(--primary);
}


.share-pwd-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--primary);
  font-size: 13px;
}

.share-card-lock {
  display: inline-flex;
  vertical-align: -2px;
  margin-right: 5px;
  color: var(--text-regular);
}

.share-manage-pwd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.share-manage-meta {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.share-manage-meta .share-expire-label:not(:first-child) { margin-top: 10px; }
.share-manage-meta-actions { margin-top: 8px; display: flex; justify-content: flex-end; }
.share-manage-expiry {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 0 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-size: 13px;
}
.share-manage-expiry-options { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.share-manage-expiry-option { position: relative; cursor: pointer; }
.share-manage-expiry-option input { position: absolute; opacity: 0; pointer-events: none; }
.share-manage-expiry-option span {
  display: block;
  min-width: 38px;
  padding: 5px 8px;
  border: 1px solid var(--border-base);
  border-radius: 999px;
  color: var(--text-regular);
  background: var(--background-white);
  text-align: center;
  line-height: 1;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.share-manage-expiry-option input:checked + span { color: white; border-color: var(--primary); background: var(--primary); }
.share-manage-expiry-option input:focus-visible + span { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.share-manage-expiry-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

@media (max-width: 520px) {
  .share-manage-expiry-actions { width: 100%; justify-content: flex-end; }
}

.share-manage-pwd .share-password-input {
  flex: 1 1 220px;
  height: 34px;
  padding: 0 12px;
  min-width: 0;
}

.share-file-count {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px;
  background: var(--background);
  border-radius: var(--radius);
}

/* 分享管理 */
.shares-section {
  margin-top: 24px;
}

.shares-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.shares-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.shares-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

.share-card-main {
  flex: 1;
  min-width: 0;
}

.share-card-code {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.share-card-meta {
  font-size: 13px;
  color: var(--text-regular);
  margin-top: 2px;
}

.share-card-expiry.is-limited { color: var(--danger); }
.share-card-expiry.is-permanent { color: #2563eb; }
.share-card-permission { color: #2563eb; }
.share-card-permission.is-preview-only { color: #a16207; }


.share-card-stats {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.share-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
}

/* Approved compact share-list layout; keep settings and other cards unchanged. */
@media(min-width:1100px){
  #shareTab #sharesList .share-card{grid-template-columns:minmax(300px,1fr) 200px 150px 110px 138px;column-gap:24px;row-gap:3px;min-height:78px;padding:12px 16px;border-radius:10px}
  #shareTab #sharesList .share-card-main,#shareTab #sharesList .share-card-top{display:contents}
  #shareTab #sharesList .share-card-code{grid-column:1;grid-row:1;display:block;white-space:nowrap;text-overflow:ellipsis;line-height:22px;font-size:14px}
  #shareTab #sharesList .share-card-meta{grid-column:1;grid-row:2;margin:0;gap:3px;flex-wrap:nowrap;white-space:nowrap;font-size:11px}
  #shareTab #sharesList .share-card-stats{grid-column:2;grid-row:1 / 3;margin:0;gap:12px;flex-wrap:nowrap}
  #shareTab #sharesList .share-card-last{grid-column:3;grid-row:1 / 3;font-size:12px;white-space:nowrap}
  #shareTab #sharesList .share-card-expiry{grid-column:4;grid-row:1 / 3;padding:0}
  #shareTab #sharesList .share-card-actions{grid-column:5;grid-row:1 / 3;justify-content:flex-start}
}
#sharesList{gap:6px}
#sharesList .share-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 10px;align-items:center;padding:10px 14px;box-shadow:none}
#sharesList .share-card-main{grid-column:1 / -1;min-width:0}
#sharesList .share-card-top{display:flex;align-items:flex-start;justify-content:space-between;gap:20px}
#sharesList .share-card-code{line-height:1.55;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-width:0}
#sharesList .share-card-expiry{flex-shrink:0;white-space:nowrap;font-size:12px;padding-top:3px}
#sharesList .share-card-expiry.is-upcoming{color:#b87516}
#sharesList .share-card-expiry.is-expired{color:#8b8880}
#sharesList .share-card-meta{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-top:4px;font-size:12px;color:#74716a}
#sharesList .share-card-permission{color:#74716a}
#sharesList .share-card-stats{display:flex;gap:14px;flex-wrap:wrap;margin-top:5px;font-size:12px;color:#848078}
#sharesList .share-card-stats b{font-weight:500;color:#57544d;font-variant-numeric:tabular-nums}
#sharesList .share-card-last{font-size:11px;color:#a19d96;min-width:0}
#sharesList .share-card-actions{width:auto;display:flex;gap:6px;margin:0;justify-content:flex-end}
#sharesList .share-card-actions .icon-btn{width:30px;height:30px;padding:0}
@media(max-width:600px){
  #sharesList .share-card{padding:10px 12px;row-gap:0}
  #sharesList .share-card-top{gap:12px}
  #sharesList .share-card-code{font-size:14px}
  #sharesList .share-card-expiry{font-size:11px}
  #sharesList .share-card-stats{margin-top:5px}
}

@media (max-width: 500px) {
  .preview-box {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .help-table tbody td {
    padding: 10px 8px;
    font-size: 12px;
  }

  .help-content {
    padding: 12px;
  }
}

/* 分享管理 */
.share-manage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.share-manage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.share-manage-list {
  max-height: 400px;
  overflow-y: auto;
}
.share-manage-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-bottom: 4px;
  transition: background 0.2s;
}
.share-manage-item:hover {
  background: var(--background);
}
.share-manage-item .file-icon {
  width: 32px; height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 9px;
  font-weight: 600;
  flex-shrink: 0;
  margin-right: 10px;
}
.share-manage-item .file-icon.image {
  border-radius: 4px;
  overflow: hidden;
}
.share-manage-item .file-icon.image img {
  width: 32px; height: 32px;
  object-fit: cover;
}

@media (max-width: 560px) {
  .share-card { align-items: flex-start; flex-wrap: wrap; padding: 12px; }
  .share-card-main { flex: 0 0 100%; }
  .share-card-actions { width: 100%; flex: 0 0 100%; justify-content: flex-end; margin: 8px 0 0; }
}
.share-manage-item-info {
  flex: 1;
  min-width: 0;
}
.share-manage-item-name {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-manage-item-size {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.share-manage-item-remove {
  flex-shrink: 0;
  margin-left: 8px;
}
.share-add-item {
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.share-add-item:hover {
  background: var(--background);
}
/* Administrator center: isolated light-theme layout. */
.admin-shell{background:var(--background);border-radius:18px;padding:30px!important;box-shadow:var(--shadow-md)}.admin-shell .page-header{padding:8px 4px 22px;border-bottom:1px solid var(--border-light)}.admin-shell h1{font-size:28px;letter-spacing:-.4px}.admin-shell .card{border:0;box-shadow:var(--shadow-sm);border-radius:14px}.admin-shell .section-title>div{display:flex;flex-wrap:wrap;gap:8px}.admin-shell .form-input{height:40px}.admin-shell table{background:var(--background-white)}.admin-shell th{background:var(--border-light);color:var(--text-secondary)}.admin-shell tr:hover td{background:var(--background)}.admin-shell a.btn{display:inline-flex;align-items:center;text-decoration:none}.admin-shell .stats-grid{gap:18px}.admin-shell .stat-card{border:0;box-shadow:var(--shadow-sm)}
.admin-shell{width:min(1440px,calc(100% - 48px));margin:36px auto 64px;padding:0!important}.admin-shell #create{display:flex;gap:10px;align-items:center}.admin-shell #create .form-input{max-width:260px}.admin-shell .danger{background:var(--danger);color:var(--background-white);border-color:var(--danger)}.admin-shell select,.admin-shell input{padding:8px 10px;border:1px solid var(--border-base);border-radius:6px;margin-right:6px}@media(max-width:760px){.admin-shell{width:calc(100% - 24px);margin:18px auto}.admin-shell #create{align-items:stretch;flex-direction:column}.admin-shell #create .form-input{max-width:none}}
.page-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:24px}.page-header h1{margin:0 0 8px}.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:0 0 20px}.stat-card{background:var(--background-white);border:1px solid var(--border-base);border-radius:12px;padding:18px;box-shadow:var(--shadow-sm)}.stat-label{color:var(--text-secondary);font-size:14px}.stat-value{margin-top:7px;color:var(--text-primary);font-size:26px;font-weight:700}.card{margin:20px 0;padding:20px;background:var(--background-white);border:1px solid var(--border-base);border-radius:12px;box-shadow:var(--shadow-sm)}.card h2{margin:0 0 16px;font-size:20px}.section-title{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px}.section-title h2{margin:0}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse;min-width:760px}th,td{padding:12px 10px;text-align:left;border-bottom:1px solid var(--border-base);vertical-align:top}th{color:var(--text-secondary);font-size:13px;font-weight:600;background:var(--background)}td{color:var(--text-regular);font-size:14px}code{display:inline-block;max-width:100%;overflow-wrap:anywhere;padding:2px 5px;border-radius:4px;background:var(--border-light);color:var(--text-regular)}.error-msg{min-height:20px;color:var(--danger)}.text-muted{color:var(--text-secondary)}@media(max-width:760px){.page-header{flex-direction:column}.stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.container{padding:18px!important}.card{padding:14px}.section-title{align-items:flex-start;flex-direction:column}}
.canvas-dialog-overlay { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px; background: rgba(17,17,17,.42); backdrop-filter: blur(6px); }
.canvas-dialog { width: min(420px,100%); display: grid; gap: 16px; padding: 22px; border-radius: 18px; background: var(--card-bg,var(--background-white)); box-shadow: 0 24px 70px rgba(0,0,0,.22); }
.canvas-dialog h3 { margin: 0; font-size: 18px; }
.canvas-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* ===== 任务看板（泳道图） ===== */
#taskTab.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.task-board {
  display: flex;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  background: var(--background);
}
.task-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* flex stretch 天然等高：所有列高度 = 最高的一列 */
}
.task-col + .task-col {
  border-left: 1px solid var(--border-base); /* 竖线分割 */
}
.task-col.drag-over {
  background: var(--border-light);
}
.task-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-strong);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.task-col-count {
  background: var(--border-light);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.task-col-body {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-col-empty {
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
  padding: 24px 0;
}
.task-card {
  background: var(--background-white);
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  touch-action: pan-y; /* 允许纵向滚动翻页；横向拖动由 JS 接管 */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* iOS 长按不弹菜单/文本选择 */
  position: relative;
  will-change: transform;
}
.task-card.dragging {
  z-index: 20;
  background: var(--background);
  box-shadow: var(--shadow-md);
  cursor: grabbing;
}
.task-card-placeholder { opacity: .4; }
.task-card-ghost {
  box-shadow: var(--shadow-md);
  cursor: grabbing;
  background: var(--background-white);
}
.task-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 4px;
  word-break: break-word;
}
.task-group-filter {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 2px;
  gap: 4px;
  align-items: center;
  background: var(--background);
  border-radius: var(--radius);
}
.task-modal { max-width: 520px; }
.task-field {
  display: block;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-regular);
}
.task-field .form-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  font-weight: 400;
}
.task-field .task-desc { resize: vertical; min-height: 90px; }
.task-group-manage {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.task-group-input-wrap { margin-top: 6px; }
.task-group-input-wrap[hidden] { display: none; }
.task-group-input-box { position: relative; }
.task-group-input-box .task-group-input { width: 100%; padding-right: 72px; margin: 0; }
.task-group-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: background-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.task-group-icon:hover { background: var(--border-light); }
.task-group-icon[data-group-save] { right: 34px; color: var(--text-secondary); }
.task-group-icon[data-group-cancel] { right: 2px; color: var(--text-secondary); }
.task-manage-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.task-group-picker { position: relative; }
.task-group-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: var(--background-white);
  border: 1px solid var(--border-base);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-regular);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.task-group-trigger:hover { border-color: var(--primary-light); }
.task-group-trigger:focus-within { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--border-light); }
.task-group-caret { color: var(--text-secondary); margin-left: auto; transition: transform .15s ease; }
.task-group-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.task-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-regular);
  border-radius: var(--radius);
  transition: background .12s ease;
}
.task-group-item:hover { background: var(--background); }
.task-group-item.selected { color: var(--primary); font-weight: 600; background: var(--background); }
.task-group-item.task-group-new { color: var(--primary); font-weight: 500; }
.task-group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-group-ops { display: none; gap: 2px; flex-shrink: 0; }
.task-group-item:hover .task-group-ops { display: flex; }
.task-group-ops button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.task-group-ops button:hover { color: var(--danger); background: var(--border-light); }
.task-group-rename-input,
.task-group-new-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--primary-light);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  outline: none;
}
.task-group-rename-input:focus,
.task-group-new-input:focus { border-color: var(--primary); }
.task-card-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--background);
  border: 1px solid var(--border-base);
  border-radius: 4px;
  padding: 1px 6px;
}
.task-card-tag.source { color: var(--primary); border-color: var(--border-light); background: var(--border-light); }
.task-card-desc {
  font-size: 12px;
  color: var(--text-regular);
  margin-bottom: 8px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 18px; /* 避开右上角删除按钮 */
}
.task-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}
.task-card-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  border-radius: var(--radius);
  transition: background-color .15s ease, color .15s ease;
}
.task-card-del:hover { color: var(--danger); background: var(--border-light); }
@media (max-width: 900px) {
  .task-board { flex-wrap: wrap; height: auto; }
  .task-col { flex: 1 1 50%; max-width: 50%; height: auto; min-height: 200px; }
  .task-col:nth-child(3) { border-left: none; }
}
@media (max-width: 560px) {
  .task-board { flex-direction: column; }
  .task-col { flex: 1 1 100%; max-width: 100%; }
  .task-col + .task-col { border-left: none; border-top: 1px solid var(--border-base); }
}

/* 触屏设备：输入控件 ≥16px，避免 iOS/iPhone 聚焦时自动放大页面（键盘遮挡上滚为系统原生行为） */
@media (pointer:coarse) {
  input, textarea, select { font-size: 16px !important; }
}
