:root {
  --bg: #f4f6fb;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-solid: #ffffff;
  --surface-alt: rgba(248, 250, 252, 0.72);
  --border: rgba(226, 232, 240, 0.85);
  --border-strong: rgba(203, 213, 225, 0.9);
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: rgba(238, 242, 255, 0.78);
  --secondary-border: #c7d2fe;
  --secondary-hover: rgba(224, 231, 255, 0.9);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --topbar-bg: rgba(255, 255, 255, 0.72);
  --hover-row: rgba(241, 245, 249, 0.75);
  --track-bg: #e2e8f0;
  --input-bg: rgba(255, 255, 255, 0.84);
  --ghost-hover: rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  --card-shadow: 0 20px 50px rgba(15, 23, 42, 0.09);
}

body.theme-dark {
  --bg: #0b0f19;
  --surface: rgba(20, 26, 41, 0.74);
  --surface-solid: #141a29;
  --surface-alt: rgba(27, 35, 54, 0.72);
  --border: rgba(51, 65, 85, 0.62);
  --border-strong: rgba(71, 85, 105, 0.75);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.18);
  --secondary-border: rgba(99, 102, 241, 0.35);
  --secondary-hover: rgba(99, 102, 241, 0.28);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.35);
  --success: #22c55e;
  --topbar-bg: rgba(16, 22, 36, 0.72);
  --hover-row: rgba(30, 41, 59, 0.65);
  --track-bg: #263047;
  --input-bg: rgba(15, 20, 34, 0.78);
  --ghost-hover: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.38);
  --card-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 14%, rgba(99, 102, 241, 0.14) 0%, transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(56, 189, 248, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 75% 85%, rgba(168, 85, 247, 0.1) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.45s ease, color 0.45s ease;
}

body.theme-dark {
  background-image:
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.22) 0%, transparent 44%),
    radial-gradient(circle at 85% 20%, rgba(30, 64, 175, 0.22) 0%, transparent 42%),
    radial-gradient(circle at 70% 85%, rgba(124, 58, 237, 0.14) 0%, transparent 46%);
}

.login-card,
.topbar,
.dropzone,
.upload-panel,
.card,
.tab-switcher,
.tab-btn,
.browser-toolbar,
.browser-footer,
.file-table th,
.file-table td,
.note-item,
.note-content,
.modal-dialog,
.modal-header,
.modal-footer,
.input-wrap input,
.search-box input,
.select-input,
.text-input,
.notes-composer textarea,
.btn-outline,
.btn-secondary,
.btn-ghost {
  transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
  font-size: 12px;
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--secondary-border);
}
.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--ghost-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-hover);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--ghost-hover);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Portal / Login View */
.login-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: #f4f6fb;
  background-image: radial-gradient(circle at 20% 20%, #e0e7ff 0%, transparent 45%),
                    radial-gradient(circle at 80% 80%, #dbeafe 0%, transparent 45%);
  overflow: hidden;
}

.login-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: #0b0f19;
  background-image: radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.22) 0%, transparent 48%),
                    radial-gradient(circle at 80% 80%, rgba(30, 58, 138, 0.24) 0%, transparent 48%);
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

body.theme-dark .login-shell::before {
  opacity: 1;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px 32px;
  box-shadow: var(--card-shadow);
  text-align: center;
}

.login-card h1 {
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 700;
}

.portal-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-form-actions {
  display: flex;
  gap: 10px;
}
.portal-form-actions .btn {
  flex: 1;
  padding: 10px 14px;
}

.login-form {
  text-align: left;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.input-wrap input {
  width: 100%;
  padding: 11px 13px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}
.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.error-banner {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* App Shell */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--topbar-bg);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
}

.app-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-switcher {
  display: inline-flex;
  background: var(--bg);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  line-height: 17px;
}

.main-content {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Dropzone */
.dropzone {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dropzone-icon svg {
  width: 22px;
  height: 22px;
}

.dropzone-title {
  font-weight: 600;
  font-size: 14.5px;
}

.dropzone-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 4px;
  user-select: none;
}

/* Upload Queue Panel */
.upload-panel {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}

.upload-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.upload-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.overall-progress-track {
  height: 7px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.overall-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #6366f1);
  border-radius: 999px;
  transition: width 0.15s linear;
}

.upload-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.upload-item-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.upload-status-ok { color: var(--success); font-weight: 500; }
.upload-status-err { color: var(--danger); font-weight: 500; }
.upload-status-cancel { color: var(--warning); font-weight: 500; }

.item-progress-track {
  height: 5px;
  background: var(--track-bg);
  border-radius: 999px;
  overflow: hidden;
}

.item-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.12s linear;
}
.item-progress-fill.done { background: var(--success); }
.item-progress-fill.error { background: var(--danger); }

/* Browser Card */
.card {
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.browser-toolbar {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13.5px;
}

.crumb-btn {
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.crumb-btn:hover {
  background: var(--bg);
  color: var(--text);
}
.crumb-btn.active {
  color: var(--text);
  font-weight: 600;
}
.crumb-sep {
  color: var(--border-strong);
  user-select: none;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 9px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-box input {
  padding: 6px 10px 6px 29px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  width: 180px;
  outline: none;
}
.search-box input:focus {
  border-color: var(--primary);
}

.select-input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}

.bulk-bar {
  background: var(--primary-soft);
  border-bottom: 1px solid var(--secondary-border);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* File Table */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.file-table th {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.file-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.file-table tbody tr:last-child td {
  border-bottom: none;
}

.file-table tbody tr:hover {
  background: var(--hover-row);
}

.file-table tbody tr.parent-dir-row {
  cursor: pointer;
}

.file-table tbody tr.parent-dir-row:hover .parent-dir-link {
  color: var(--primary);
  text-decoration: underline;
}

.col-check {
  width: 40px;
  text-align: center;
}

.col-size {
  width: 110px;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12.5px;
}

.col-time {
  width: 165px;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12.5px;
}

.col-actions {
  width: 220px;
  text-align: right;
  white-space: nowrap;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.file-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-icon svg {
  width: 17px;
  height: 17px;
}
.icon-dir { background: rgba(217, 119, 6, 0.16); color: #f59e0b; }
.icon-image { background: rgba(22, 163, 74, 0.16); color: #22c55e; }
.icon-video { background: rgba(162, 28, 175, 0.16); color: #d946ef; }
.icon-audio { background: rgba(234, 88, 12, 0.16); color: #fb923c; }
.icon-pdf { background: rgba(220, 38, 38, 0.16); color: #f87171; }
.icon-archive { background: rgba(99, 102, 241, 0.18); color: #818cf8; }
.icon-text { background: rgba(2, 132, 199, 0.16); color: #38bdf8; }
.icon-file { background: rgba(148, 163, 184, 0.16); color: #94a3b8; }

.name-link {
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: 13.5px;
  text-align: left;
  word-break: break-all;
}
.name-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.empty-state {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--border-strong);
  margin-bottom: 10px;
}
.empty-state p {
  margin: 0;
  font-size: 13.5px;
}

.browser-footer {
  padding: 10px 18px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Notes Tab */
.notes-card {
  padding: 20px;
}

.notes-composer textarea {
  width: 100%;
  padding: 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  resize: vertical;
  outline: none;
}
.notes-composer textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}

.notes-composer-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.notes-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.note-actions {
  display: flex;
  gap: 6px;
}

.note-content {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  max-height: 280px;
  overflow-y: auto;
}

/* Global Drop Overlay */
.global-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(79, 70, 229, 0.14);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.global-drop-box {
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 2px dashed var(--primary);
  border-radius: 18px;
  padding: 42px 54px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(79, 70, 229, 0.22);
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
}
.global-drop-box svg {
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-dialog {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 920px; }

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h3 {
  margin: 0;
  font-size: 15px;
}
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-body {
  padding: 18px;
  overflow: auto;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.text-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}
.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}

.prompt-desc {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--text);
}

/* Conflict Modal */
.conflict-dialog {
  max-width: 470px;
}

.conflict-location {
  margin-bottom: 10px;
  word-break: break-all;
}

.conflict-compare {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.conflict-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.conflict-role {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-top: 1px;
}

.conflict-role-target {
  background: var(--danger-soft);
  color: var(--danger);
}

.conflict-file-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conflict-name {
  font-size: 13.5px;
  word-break: break-all;
}

.conflict-rename-box {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.conflict-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.conflict-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
}

.conflict-apply-all {
  margin-top: 14px;
  margin-left: 0;
}

.conflict-footer .btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  min-height: 260px;
}
.preview-body.text-mode {
  background: var(--surface);
  align-items: stretch;
  justify-content: flex-start;
}
.preview-body img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
}
.preview-body video {
  max-width: 100%;
  max-height: 72vh;
}
.preview-body audio {
  width: 100%;
  max-width: 520px;
}
.preview-body iframe {
  width: 100%;
  height: 72vh;
  border: none;
  background: #fff;
}
.preview-text {
  margin: 0;
  width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

/* Warning Modal (always dark) */
.warning-backdrop {
  z-index: 95;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.warning-dialog {
  width: 100%;
  max-width: 340px;
  background: rgba(20, 24, 36, 0.82);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid rgba(58, 70, 99, 0.65);
  border-radius: 16px;
  padding: 32px 28px 26px;
  text-align: center;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65);
  animation: fadeSlide 0.18s ease;
}

.warning-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.45);
}

.warning-text {
  color: #f8fafc;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 88;
  background: rgba(244, 246, 251, 0.36);
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: loadingFadeIn 0.16s ease;
}

body.theme-dark .loading-overlay {
  background: rgba(7, 10, 19, 0.48);
}

.loading-card {
  max-width: 92vw;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 20px;
  padding: 30px 34px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}

body.theme-dark .loading-card {
  background: rgba(20, 26, 41, 0.68);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.loading-spinner {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-right-color: rgba(99, 102, 241, 0.32);
  animation: spinCW 0.9s cubic-bezier(0.55, 0.18, 0.45, 0.82) infinite;
}

.spinner-ring-inner {
  inset: 9px;
  border-width: 2.5px;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: #818cf8;
  border-left-color: rgba(129, 140, 248, 0.35);
  animation: spinCCW 1.15s linear infinite;
}

.spinner-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.65);
  animation: dotPulse 1.2s ease-in-out infinite;
}

.loading-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}

.loading-hint {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

@keyframes spinCW {
  to { transform: rotate(360deg); }
}

@keyframes spinCCW {
  to { transform: rotate(-360deg); }
}

@keyframes dotPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.7; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}

@keyframes loadingFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  animation: fadeSlide 0.18s ease;
}
body.theme-dark .toast {
  background: rgba(30, 41, 59, 0.84);
  border: 1px solid rgba(71, 85, 105, 0.65);
}
.toast.error { background: rgba(220, 38, 38, 0.9); border-color: transparent; }
.toast.success { background: rgba(21, 128, 61, 0.9); border-color: transparent; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .topbar {
    padding: 10px 14px;
    flex-wrap: wrap;
  }
  .main-content {
    padding: 14px 12px 32px;
  }
  .col-time {
    display: none;
  }
  .search-box input {
    width: 135px;
  }
  .col-actions {
    width: auto;
  }
  .loading-card {
    padding: 24px 20px;
  }
}
