/* Workspace refinement: clear hierarchy, restrained surfaces and touch targets. */
:root {
  --bg-base: #0b1019;
  --surface-glass: rgba(20, 28, 42, .78);
  --surface-card: rgba(19, 27, 40, .9);
  --surface-hover: rgba(26, 36, 52, .96);
  --surface-sheet: rgba(19, 27, 40, .98);
  --text-secondary: #a4b0c2;
  --text-tertiary: #8794a8;
  --border-subtle: rgba(172, 194, 226, .1);
  --primary: #347deb;
  --primary-hover: #458cf5;
  --accent: #85b6ff;
  --shadow-subtle: 0 8px 28px rgba(0, 0, 0, .12);
  --shadow-elevated: 0 18px 48px rgba(0, 0, 0, .24);
}

body { padding: 32px 24px 48px; background-image: radial-gradient(ellipse at 50% 0, rgba(41, 91, 158, .15), transparent 65%); }
.app-container { max-width: 1056px; gap: 22px; }
.app-header { padding: 16px 22px; border-radius: 18px; }
.logo-badge { width: 38px; height: 38px; border-radius: 12px; box-shadow: none; }
.logo-text { display: flex; flex-direction: column; gap: 3px; }
.logo-title { font-size: 19px; letter-spacing: -.6px; }
.logo-caption { color: var(--text-tertiary); font-size: 11px; letter-spacing: .4px; }
.header-left { gap: 22px; }
.status-pill { box-shadow: none; max-width: 220px; }
#role-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-tag { background: transparent; color: var(--text-secondary); border-color: transparent; }
.guest-preview-banner { padding: 24px; background: linear-gradient(120deg, rgba(36, 63, 103, .3), rgba(20, 32, 48, .65)); box-shadow: none; }
.guest-banner-title { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; font-size: 19px; font-weight: 600; }
.guest-banner-pill { font-size: 11px; font-weight: 500; color: var(--accent); background: transparent; padding: 0; }
.guest-features-grid { gap: 14px; margin-top: 22px; }
.feature-mini-card { padding: 16px; border-color: var(--border-subtle); background: rgba(255, 255, 255, .025); }
.feature-mini-title { font-size: 13px; margin-bottom: 6px; }
.feature-mini-desc, .guest-footer-hint { font-size: 12px; line-height: 1.7; }
.guest-banner-footer { margin-top: 18px; padding-top: 15px; }
.nav-tabs { padding: 5px; gap: 5px; box-shadow: none; }
.nav-tab { min-height: 42px; font-size: 13px; }
.nav-tab.active { background: rgba(97, 139, 205, .14); color: #d6e6ff; box-shadow: none; }
.nav-tab.active .tab-badge { background: rgba(98, 158, 255, .2); }
.dropzone { padding: 25px; background: linear-gradient(130deg, rgba(33, 61, 99, .18), rgba(19, 29, 43, .5)); border-color: rgba(133, 182, 255, .24); }
.dropzone-content { display: flex; flex-direction: column; align-items: center; }
.dropzone-icon-wrap { width: 54px; height: 54px; margin-bottom: 14px; }
.drop-svg-icon { width: 27px; height: 27px; }
.pulse-ring { display: none; }
.drop-text-primary { font-size: 16px; font-weight: 550; }
.drop-text-secondary { margin-top: 7px; font-size: 12px; }
.dropzone.guest-locked { border-color: rgba(133, 182, 255, .16); background: rgba(255, 255, 255, .018); }
.section-header { margin-bottom: 18px; align-items: center; }
.section-title { color: var(--text-primary); font-size: 17px; font-weight: 600; }
.section-description { margin-top: 5px; color: var(--text-tertiary); font-size: 12px; }
.btn-refresh { width: 36px; height: 36px; border: 1px solid var(--border-subtle); background: rgba(255, 255, 255, .025); }
.btn { min-height: 36px; border-radius: 10px; font-weight: 500; box-shadow: none; }
.btn-primary, .btn-primary:hover { box-shadow: none; }
.btn-small { min-height: 32px; padding: 6px 12px; }
.btn-secondary { background: rgba(255, 255, 255, .04); }
.file-toolbar { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.file-search { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; max-width: 440px; min-height: 42px; padding: 0 14px; color: var(--text-tertiary); background: rgba(255, 255, 255, .035); border: 1px solid var(--border-subtle); border-radius: 12px; }
.file-search input { background: transparent; border: 0; box-shadow: none; color: var(--text-primary); padding: 10px 0; font-size: 13px; outline: 0; min-width: 0; width: 100%; }
.file-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 158, 255, .1); }
.file-search input::placeholder { color: var(--text-tertiary); }
.file-toolbar-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-filters { display: flex; gap: 3px; padding: 4px; border: 1px solid var(--border-subtle); border-radius: 11px; background: rgba(255, 255, 255, .025); }
.file-filter { padding: 7px 12px; min-height: 32px; background: transparent; border: 0; border-radius: 7px; color: var(--text-secondary); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.file-filter.active { color: #d6e6ff; background: rgba(113, 160, 229, .16); }
.file-sort-wrap { display: flex; align-items: center; gap: 6px; padding: 0 10px; min-height: 40px; border: 1px solid var(--border-subtle); border-radius: 11px; background: rgba(255, 255, 255, .025); color: var(--text-secondary); position: relative; }
.file-sort-icon { color: var(--text-tertiary); flex-shrink: 0; }
.file-sort-select { background: transparent; border: 0; color: var(--text-primary); font: inherit; font-size: 12px; cursor: pointer; outline: 0; padding: 6px 14px 6px 2px; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238899aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 2px center; }
.file-sort-select option { background: #161e2e; color: #fff; }

.file-batch-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; margin-bottom: 12px; border-radius: 12px; background: rgba(67, 131, 232, .08); border: 1px solid rgba(109, 168, 255, .22); }
.batch-bar-left { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-primary); }
.batch-select-all-label { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; font-weight: 500; }
.batch-checkbox, .file-select-checkbox { width: 15px; height: 15px; border-radius: 4px; accent-color: var(--accent); cursor: pointer; }
.batch-selected-count { font-size: 12px; color: #a7cbff; padding: 2px 8px; border-radius: 6px; background: rgba(67, 131, 232, .16); font-feature-settings: "tnum"; font-weight: 500; }
.batch-bar-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.btn-batch-action { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 6px 12px; min-height: 32px; background: rgba(255, 255, 255, .05); border: 1px solid var(--border-subtle); color: var(--text-primary); border-radius: 8px; cursor: pointer; }
.btn-batch-action:hover { background: rgba(255, 255, 255, .1); }
.btn-batch-action:disabled { opacity: .4; cursor: not-allowed; }
.btn-batch-danger { color: #f29b9b; border-color: rgba(238, 158, 158, .22); }
.btn-batch-danger:hover { background: rgba(238, 158, 158, .12); }
.btn-batch-cancel { background: transparent; border: 0; color: var(--text-tertiary); font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.btn-batch-cancel:hover { color: var(--text-primary); background: rgba(255, 255, 255, .05); }

.file-select-wrap { display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-right: -4px; }
.file-card.selected { border-color: rgba(98, 158, 255, .32); background: rgba(67, 131, 232, .05); }

/* 文件夹与层级面包屑 */
.btn-new-folder { display: inline-flex; align-items: center; gap: 6px; }
.folder-breadcrumb { display: flex; align-items: center; gap: 6px; padding: 8px 14px; margin-bottom: 12px; background: rgba(255, 255, 255, .02); border: 1px solid var(--border-subtle); border-radius: 10px; font-size: 13px; }
.breadcrumb-trail { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumb-crumb { background: transparent; border: 0; color: var(--accent); cursor: pointer; padding: 3px 6px; border-radius: 6px; font: inherit; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.breadcrumb-crumb:hover { background: rgba(98, 158, 255, .1); }
.breadcrumb-crumb.active { color: var(--text-primary); font-weight: 600; cursor: default; }
.breadcrumb-crumb.active:hover { background: transparent; }
.breadcrumb-separator { color: var(--text-tertiary); font-size: 11px; }

/* 文件夹卡片 */
.folder-card { padding: 14px 18px; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; transition: all .15s ease; border: 1px solid rgba(232, 180, 78, .18); background: rgba(232, 180, 78, .03); }
.folder-card:hover { border-color: rgba(232, 180, 78, .35); background: rgba(232, 180, 78, .06); transform: translateY(-1px); }
.folder-info { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.folder-icon-badge { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(232, 180, 78, .12); color: #f5c46b; flex-shrink: 0; }
.folder-meta { flex: 1; min-width: 0; }
.folder-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.folder-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }
.folder-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-open-folder { background: rgba(232, 180, 78, .1); border-color: rgba(232, 180, 78, .2); color: #f5c46b; }
.btn-open-folder:hover { background: rgba(232, 180, 78, .2); }
.btn-del-folder { color: #ee9e9e; }
.folder-card-mdsync { border-color: rgba(67, 131, 232, .25); background: rgba(67, 131, 232, .04); }
.folder-card-mdsync:hover { border-color: rgba(67, 131, 232, .45); background: rgba(67, 131, 232, .08); }
.folder-badge-mdsync { background: rgba(67, 131, 232, .15); color: #629eff; }

/* 移动文件弹窗选项列表 */
.move-folder-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px; margin-bottom: 12px; }
.move-folder-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border-subtle); background: rgba(255, 255, 255, .02); cursor: pointer; transition: background .15s; }
.move-folder-item:hover, .move-folder-item.selected { background: rgba(98, 158, 255, .1); border-color: var(--accent); }
.move-folder-item input[type="radio"] { accent-color: var(--accent); }
.move-folder-title { font-size: 13px; color: var(--text-primary); font-weight: 500; }

/* 端到端加密 E2EE 控件与角标 */
.msg-target-wrap { display: flex; align-items: center; gap: 6px; padding: 0 10px; min-height: 32px; border: 1px solid rgba(80, 172, 122, .25); border-radius: 9px; background: rgba(80, 172, 122, .06); color: #8dceaa; }
.msg-lock-icon { color: #8dceaa; flex-shrink: 0; }
.msg-recipient-select { background: transparent; border: 0; color: #bad5fc; font: inherit; font-size: 12px; cursor: pointer; outline: 0; padding: 4px 14px 4px 0; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238dceaa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0 center; }
.msg-recipient-select option { background: #161e2e; color: #fff; }

.badge-e2ee { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 500; color: #8dceaa; background: rgba(80, 172, 122, .1); border: 1px solid rgba(80, 172, 122, .2); }
.badge-e2ee-target { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 5px; font-size: 10px; color: #bad5fc; background: rgba(67, 131, 232, .1); margin-left: 6px; }
.msg-locked-box { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px dashed rgba(154, 179, 215, .25); color: var(--text-secondary); font-size: 13px; font-style: italic; }
.items-list { gap: 10px; }
.file-card { padding: 17px 18px; gap: 22px; border-radius: 14px; box-shadow: none; }
.file-card:hover { transform: none; }
.file-icon-badge { width: 44px; height: 48px; border-radius: 12px; border-color: transparent; }
.file-info { gap: 15px; }
.file-meta { flex: 1; }
.file-title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-name { font-size: 14px; font-weight: 550; line-height: 1.5; }
.file-sub { margin-top: 5px; font-size: 11px; line-height: 1.6; flex-wrap: wrap; gap: 6px; }
.file-uploader-tag { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-path { color: var(--text-tertiary); font-size: 11px; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.badge-nas-status { padding: 3px 7px; border-radius: 6px; flex-shrink: 0; font-size: 10px; line-height: 1.4; }
.badge-nas-status.archived { background: rgba(80, 172, 122, .09); color: #8dceaa; border-color: transparent; }
.badge-nas-status.pending { background: rgba(232, 180, 78, .09); color: #e6c485; border-color: transparent; }
.file-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.file-actions .btn { min-height: 34px; }
.btn-download-file { background: rgba(67, 131, 232, .13); border-color: rgba(109, 168, 255, .14); color: #a7cbff; }
.btn-download-file:hover { background: rgba(67, 131, 232, .23); }
.file-actions .btn-share-link { background: transparent; border-color: var(--border-subtle); color: var(--text-secondary); }
.file-menu { position: relative; }
.file-card:has(.file-menu[open]) { position: relative; z-index: 12; }
.file-card:last-child .file-menu-panel { top: auto; bottom: calc(100% + 8px); }
.file-menu summary { display: flex; align-items: center; justify-content: center; list-style: none; width: 34px; height: 34px; border-radius: 9px; color: var(--text-secondary); cursor: pointer; }
.file-menu summary::-webkit-details-marker { display: none; }
.file-menu summary:hover, .file-menu[open] summary { background: rgba(255, 255, 255, .07); color: var(--text-primary); }
.file-menu-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 166px; padding: 6px; background: #1b2637; border: 1px solid rgba(154, 179, 215, .18); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .4); z-index: 10; }
.file-menu-panel button { display: block; width: 100%; border: 0; padding: 10px 12px; text-align: left; background: transparent; color: var(--text-primary); font: inherit; font-size: 12px; border-radius: 7px; cursor: pointer; }
.file-menu-panel button:hover { background: rgba(255, 255, 255, .07); }
.file-menu-panel .btn-delete-file { color: #ee9e9e; border-top: 1px solid var(--border-subtle); margin-top: 4px; }
.guest-locked-card { padding: 32px 24px; gap: 13px; background: rgba(255, 255, 255, .015); }
.locked-title { font-size: 16px; }
.modal-card { max-width: 740px; border-radius: 22px; }
#modal-auth-gate .modal-card { max-width: 540px; }
#modal-file-share .modal-card { max-width: 560px; }
.modal-header { padding: 20px 24px; }
.modal-body { padding: 24px; }
.modal-close { min-width: 36px; min-height: 36px; }
.form-hint { font-size: 12px; line-height: 1.65; }
.admin-card { padding: 19px; border-radius: 14px; background: rgba(255, 255, 255, .025); }
.admin-card h4 { font-size: 14px; margin-bottom: 12px; }
.active-sync-device { padding: 10px 13px; margin: 0 0 10px; border-radius: 9px; font-size: 13px; line-height: 1.5; color: #bad5fc; background: rgba(67, 131, 232, .1); overflow-wrap: anywhere; }
.devices-table-wrap { overflow-x: auto; }
.devices-table-wrap table { min-width: 440px; }
.devices-table-wrap th { font-weight: 500; color: var(--text-tertiary); padding-bottom: 12px !important; }
.devices-table-wrap td { padding-top: 13px !important; padding-bottom: 13px !important; }
.devices-table-wrap tbody tr:hover { background: rgba(255, 255, 255, .02); }
.devices-table-wrap .btn-use-cli { min-width: 74px; }
.setup-details > summary { font-size: 13px; color: var(--text-secondary); cursor: pointer; line-height: 1.6; }
.setup-details[open] > summary { color: var(--text-primary); margin-bottom: 14px; }
.code-box { margin-top: 10px; box-shadow: none; border-color: var(--border-subtle); }
.msg-sender { padding: 22px; }
.msg-sender textarea { font-size: 14px; line-height: 1.7; }
.msg-card { box-shadow: none; }
.toast { border-radius: 12px; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .55; cursor: default; }
.hidden { display: none !important; }

@media (max-width: 720px) {
  body { padding: 18px 14px 32px; }
  .app-container { gap: 16px; }
  .app-header { padding: 13px 15px; }
  .header-left { gap: 10px; }
  .header-right { gap: 7px; }
  .logo-title { font-size: 17px; }
  .logo-badge { width: 32px; height: 32px; }
  .logo-caption, .device-tag { display: none; }
  .status-pill { max-width: 112px; font-size: 10px; }
  .guest-preview-banner { padding: 20px; }
  .guest-banner-title { font-size: 16px; line-height: 1.6; }
  .guest-features-grid { grid-template-columns: 1fr; gap: 9px; margin-top: 18px; }
  .feature-mini-card { padding: 12px 14px; }
  .guest-banner-footer { padding-top: 12px; margin-top: 14px; }
  .guest-footer-hint { font-size: 11px; }
  .nav-tab { padding: 8px 7px; gap: 6px; min-height: 42px; font-size: 12px; }
  .dropzone { padding: 24px 14px; }
  .drop-text-primary { font-size: 14px; }
  .drop-text-secondary { font-size: 11px; line-height: 1.6; }
  .file-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .file-search { max-width: none; }
  .file-search input { font-size: 16px; }
  .file-toolbar-controls { width: 100%; justify-content: space-between; gap: 8px; }
  .file-filters { align-self: auto; }
  .file-sort-wrap { flex: 1; }
  .file-filter { padding: 8px 12px; }
  .file-batch-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .batch-bar-actions { width: 100%; justify-content: space-between; }
  .btn-batch-action { flex: 1; justify-content: center; min-height: 38px; }
  .file-card { flex-direction: column; align-items: stretch; padding: 15px; gap: 13px; }
  .file-info { width: 100%; }
  .file-title-row { flex-wrap: wrap; gap: 5px 9px; }
  .file-name { white-space: normal; overflow-wrap: anywhere; font-size: 14px; }
  .file-title-row .badge-nas-status { font-size: 10px; }
  .file-sub { font-size: 11px; }
  .file-actions { border-top: 1px solid var(--border-subtle); padding-top: 11px; width: 100%; flex-wrap: nowrap; gap: 8px; }
  .file-actions .btn { min-height: 40px; font-size: 12px; }
  .file-actions .btn-download-file { flex: 1; }
  .file-menu summary { width: 40px; height: 40px; }
  .file-menu-panel button { min-height: 44px; }
  .modal-card { max-height: 90dvh; border-radius: 22px 22px 0 0; }
  .modal-header { padding: 17px 18px; }
  .modal-body { padding: 20px 17px max(20px, env(safe-area-inset-bottom)); }
  .modal-body input, .modal-body textarea { font-size: 16px; }
  .msg-sender { padding: 18px; }
  .guest-locked-card { padding: 27px 20px; }
}

@media (max-width: 420px) {
  .tab-icon-svg { display: none; }
  .header-left { gap: 8px; }
  .header-right .btn { padding: 6px 9px; }
  .logo-badge { width: 29px; height: 29px; }
  .logo-title { font-size: 16px; }
  .status-pill { max-width: 92px; padding: 4px 7px; }
}

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

/* 临时公用电脑专属样式 */
.ephemeral-banner {
  background: linear-gradient(90deg, #92400e, #d97706);
  color: #fff;
  padding: 10px 18px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  position: sticky;
  top: 0;
  z-index: 9999;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.ephemeral-banner.hidden {
  display: none !important;
}
.auth-tab-btn {
  transition: all 0.2s ease;
  cursor: pointer;
}
.auth-tab-btn.active {
  background: var(--accent);
  color: #fff;
}
