/* ===== CSS Variables ===== */
:root {
  --primary: #6b7a99;
  --primary-hover: #5a6980;
  --primary-light: rgba(107, 122, 153, 0.1);
  --danger: #c0392b;
  --danger-hover: #a93226;
  --success: #5a8a5e;
  --warning: #b8860b;
  --bg: #f5f5f0;
  --bg-sidebar: #eae8e0;
  --bg-header: #f0efe8;
  --text: #2d2d2d;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8a8a;
  --border: #ddd;
  --border-light: #e8e8e3;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-sm: 4px;
  --transition: 0.2s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Noto Serif SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-gray { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-outline {
  background: var(--white);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) { background: #f0f0eb; border-color: #ccc; }

.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-success:hover:not(:disabled) { background: #4a7a4e; }

.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
}

.btn-xs {
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

.btn-icon {
  padding: 0.375rem;
  min-width: 2rem;
  min-height: 2rem;
}

.btn-warning { background: #c49a2a; color: white; }
.btn-warning:hover { background: #a88320; }
.btn-link { background: none; color: var(--primary); text-decoration: underline; border: none; }

/* ===== Form Elements ===== */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 122, 153, 0.15);
}
.form-input::placeholder { color: var(--text-muted); }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a5a5a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 2rem;
}

textarea.form-input { resize: vertical; min-height: 80px; }

/* ===== Toggle Switch ===== */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.toggle-wrap input[type="checkbox"] { display: none; }
.toggle-track {
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle-wrap input:checked + .toggle-track { background: var(--primary); }
.toggle-wrap input:checked + .toggle-track::after { transform: translateX(18px); }

/* ===== Login Page ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.login-page #waves-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 0;
}

.login-page .deco-char {
  position: fixed;
  top: 50%;
  right: 4vw;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  white-space: nowrap;
  font-family: 'Noto Serif SC', 'Songti SC', serif;
  font-size: clamp(5rem, 18vh, 10rem);
  line-height: 1.1;
  letter-spacing: 0.12em;
  color: var(--deco-color, rgba(87, 66, 102, 0.06));
  transition: color 1.6s ease;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

@media (max-width: 480px) {
  .login-page .deco-char {
    right: 2vw;
    font-size: clamp(4rem, 14vh, 7rem);
  }
}

.login-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}

.login-card h1 {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.625rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.25rem;
  color: var(--text);
  letter-spacing: 0.05em;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
}

.login-error {
  background: #fdf2f2;
  color: var(--danger);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid #f5c6c6;
}

.login-card .form-group label {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.login-card .form-input {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
}

.login-card .form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 122, 153, 0.15);
}

.login-card .form-input::placeholder {
  color: var(--text-muted);
}

.login-card .btn-primary {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 0.625rem;
  font-size: 0.9375rem;
  letter-spacing: 0.1em;
  transition: all 0.2s ease;
}

.login-card .btn-primary:hover {
  background: var(--primary-hover);
}

/* ===== App Layout ===== */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Nav */
.top-nav {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-nav .brand {
  font-family: 'Noto Serif SC', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-tabs {
  display: flex;
  gap: 0;
  height: 100%;
}

.nav-tab {
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.nav-tab:hover { color: var(--text-secondary); }
.nav-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.username-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ===== Main Content Area ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tab-panel { display: none; flex: 1; }
.tab-panel.active { display: flex; flex-direction: column; }

/* ===== Files Tab Layout ===== */
.files-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar - Directory Tree */
.sidebar {
  width: 240px;
  border-right: 1px solid var(--border-light);
  background: var(--bg-sidebar);
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sidebar-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.sidebar-toggle {
  transition: transform 0.3s ease;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.dir-tree-item {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: background var(--transition);
  gap: 0.375rem;
  user-select: none;
}
.dir-tree-item:hover { background: rgba(0,0,0,0.04); }
.dir-tree-item.active { background: rgba(107, 122, 153, 0.12); color: var(--primary); font-weight: 500; }

.dir-tree-item .icon { font-size: 1rem; flex-shrink: 0; }
.dir-tree-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dir-children { padding-left: 1rem; }

.dir-tree-item .expand-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.dir-tree-item .expand-icon.expanded { transform: rotate(90deg); }

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Breadcrumb */
.breadcrumb-bar {
  padding: 0.75rem 1rem;
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.breadcrumb-item {
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.breadcrumb-item:hover { color: var(--primary); background: var(--primary-light); }
.breadcrumb-item.current { color: var(--text); font-weight: 500; cursor: default; }
.breadcrumb-item.current:hover { background: transparent; color: var(--text); }
.breadcrumb-sep { color: var(--border); font-size: 0.75rem; }

/* Toolbar */
.toolbar {
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
}

.html-project-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.html-project-toggle input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}
.badge-html {
  font-size: 0.75rem;
  vertical-align: middle;
}

/* Upload Zone */
.upload-zone {
  margin: 1rem;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: var(--white);
  transition: all var(--transition);
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; color: var(--text-muted); }
.upload-zone .upload-text { color: var(--text-secondary); font-size: 0.875rem; }
.upload-zone .upload-text strong { color: var(--primary); }
.upload-zone .upload-hint { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.25rem; }

.upload-progress {
  margin: 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.upload-progress .progress-bar {
  height: 6px;
  background: #e8e8e3;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.375rem;
}
.upload-progress .progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.upload-progress .progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* File List */
.file-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 1rem 1rem;
}

.file-list-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.file-list-empty .empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }

.file-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-top: 0.5rem;
}

.file-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  background: #f0f0eb;
  border-bottom: 1px solid var(--border-light);
}

.file-table td {
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}

.file-table tr:last-child td { border-bottom: none; }
.file-table tr:hover td { background: #f8f8f5; }

.file-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.file-name .file-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.file-name .file-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
}
.file-name .file-name-text:hover { color: var(--primary); }

.file-actions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: nowrap;
}

.file-share-count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  font-size: 0.8125rem;
  cursor: pointer;
}
.file-share-count:hover { text-decoration: underline; }

/* Action Links */
.action-link {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 4px;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.15s;
}
.action-link:hover { background: var(--primary-light); }
.action-link.action-danger { color: var(--danger); }
.action-link.action-danger:hover { background: #fdf2f2; }
.action-link.has-shares { color: var(--success); font-weight: 600; }

/* ===== Modals ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }

.modal-lg { max-width: 700px; }

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { background: #f0f0eb; color: var(--text-secondary); }

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  color: var(--text);
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Share success box */
.share-result-box {
  background: #f8f8f5;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875rem;
  line-height: 1.8;
  word-break: break-all;
  user-select: all;
  color: var(--text);
}

/* Inline dir create */
.inline-create {
  padding: 0.5rem 0.75rem;
  display: flex;
  gap: 0.375rem;
}
.inline-create input {
  flex: 1;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  outline: none;
  color: var(--text);
}

/* ===== Settings Tab ===== */
.settings-section {
  background: var(--white);
  border-radius: 12px;
  border: none;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.settings-section h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.settings-panel {
  max-width: 100%;
  padding: 1.5rem;
  width: 100%;
}

/* Watermark two-column layout */
.wm-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.wm-settings-col {
  flex: 1;
  min-width: 300px;
}
.wm-preview-col {
  flex: 0 0 380px;
  position: sticky;
  top: 1rem;
}

.watermark-preview {
  padding: 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #f8f8f5;
  position: relative;
  min-height: 250px;
  overflow: hidden;
}

.wm-template-select { margin-bottom: 0.5rem; }
.wm-custom-template { margin-top: 0.5rem; }

.wm-preview-box {
  background: #f5f5f5;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  min-height: 250px;
}
.wm-preview-box canvas {
  display: block;
  width: 100%;
}

@media (max-width: 900px) {
  .wm-layout { flex-direction: column; }
  .wm-preview-col {
    flex: none;
    width: 100%;
    position: static;
  }
}

.watermark-preview canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ===== Storage & Trash Settings ===== */
.storage-config,
.trash-config {
  max-width: 640px;
}

.radio-group {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.25rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
}

.radio-option input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.radio-label {
  font-weight: 500;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
  line-height: 1.5;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.form-group-half {
  flex: 1;
  min-width: 0;
}

.form-group-third {
  flex: 1;
  min-width: 0;
}

@media (max-width: 600px) {
  .form-row { flex-direction: column; gap: 0; }
}

/* ===== Accounts Tab ===== */
.accounts-panel {
  max-width: 800px;
  padding: 1.5rem;
}

.accounts-section {
  background: var(--white);
  border-radius: 12px;
  border: none;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.accounts-section .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.accounts-section .data-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border-light);
  background: var(--bg);
}
.accounts-section .data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.accounts-section .data-table tr:hover {
  background: var(--bg);
}
.accounts-section .data-table th:first-child { width: 60px; }
.accounts-section .data-table th:last-child { width: 140px; white-space: nowrap; }

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border-light);
}
.account-row:last-child { border-bottom: none; }
.account-row .account-name { font-weight: 500; color: var(--text); }

/* ===== Stat Cards ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  text-align: center;
  border-top: 3px solid var(--border);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}
.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card.card-files    { border-top-color: #6b7a99; }
.stat-card.card-files .stat-number    { color: #6b7a99; }

.stat-card.card-shares   { border-top-color: #8b7a99; }
.stat-card.card-shares .stat-number   { color: #8b7a99; }

.stat-card.card-visitors { border-top-color: #b8860b; }
.stat-card.card-visitors .stat-number { color: #b8860b; }

.stat-card.card-views    { border-top-color: #5a8a5e; }
.stat-card.card-views .stat-number    { color: #5a8a5e; }

.stat-card.card-active   { border-top-color: #c0392b; }
.stat-card.card-active .stat-number   { color: #c0392b; }

@media (max-width: 768px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .stat-cards .stat-card:last-child { grid-column: 1 / -1; }
}

/* ===== Access Log Table ===== */
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.log-table th {
  text-align: left;
  padding: 0.5rem 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f0f0eb;
  border-bottom: 1px solid var(--border-light);
}
.log-table td {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.log-table tr:hover td { background: #f8f8f5; }
.log-table-wrap { overflow-x: auto; }

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 250px;
  max-width: 400px;
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  border-left: 4px solid var(--text-muted);
  color: var(--text);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }

.toast-out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ===== Color Preview ===== */
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.color-input-wrap input[type="color"] {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  cursor: pointer;
}
.color-input-wrap .color-hex {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-family: monospace;
}

/* Share Panel */
.share-panel {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin: 8px 0 12px 0;
  overflow: hidden;
  min-width: 800px;
  width: 100%;
  box-shadow: var(--shadow-sm);
}
.share-panel-inner { padding: 16px; overflow-x: auto; }
.share-panel-header {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}
.share-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 700px; }
.share-table th { background: #f0f0eb; padding: 8px 10px; text-align: left; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border-light); white-space: nowrap; }
.share-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); vertical-align: top; color: var(--text); }
.share-table tr:last-child td { border-bottom: none; }
.share-link-url { font-size: 0.78rem; color: var(--primary); word-break: break-all; }
.share-alias { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.share-panel-footer { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-light); }

/* Access Log Panel */
.access-log-panel td { padding: 0; }
.log-panel-inner { padding: 12px; background: #faf9f5; border-radius: 6px; margin: 4px; }
.log-header { font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Share View */
.share-view { padding: 0; }
.share-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}
.share-view-nav { display: flex; align-items: center; gap: 16px; }
.back-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}
.back-link:hover { text-decoration: underline; }
.share-view-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* Share View Table */
.share-view-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.share-view-table th {
  background: #f0f0eb;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}
.share-view-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}
.share-view-table tr:hover { background: #f8f8f5; }
.share-view-table .td-link { max-width: 250px; }
.share-view-table .td-link code {
  font-size: 0.75rem;
  color: var(--primary);
  word-break: break-all;
  background: none;
}
.share-view-table .td-actions { white-space: nowrap; }
.pwd-mask { color: var(--text-muted); font-family: monospace; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #fce4ec; color: #c62828; }
.badge-expired { background: #fff3e0; color: #e65100; }

/* Standalone log panel */
.log-panel-standalone {
  margin-top: 16px;
  background: #faf9f5;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
}
.log-panel-standalone .log-panel-inner { padding: 16px; }

/* ===== Spinner ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Trash Panel ===== */
.trash-panel {
  max-width: 100%;
  padding: 1.5rem;
  width: 100%;
}

.trash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.trash-header h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.trash-list-container {
  flex: 1;
  overflow-y: auto;
}

.trash-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.trash-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.trash-item-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  gap: 0.75rem;
}

.trash-item-row:hover {
  background: #f8f8f5;
}

.trash-item-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.trash-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  color: var(--text);
}

.trash-item-date {
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.trash-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .files-layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    overflow-y: visible;
  }

  .sidebar-content {
    display: none;
    padding: 0.5rem 0;
  }

  .sidebar.expanded .sidebar-content {
    display: block;
  }

  .sidebar-toggle { display: inline-block; }
  .sidebar.expanded .sidebar-toggle { transform: rotate(180deg); }

  .nav-tabs { gap: 0; }
  .nav-tab { padding: 0 0.625rem; font-size: 0.8125rem; }

  .top-nav { padding: 0 0.75rem; }

  .file-table th:nth-child(3),
  .file-table td:nth-child(3) {
    display: none;
  }
}

/* Desktop: sidebar always expanded, hide toggle button */
@media (min-width: 769px) {
  .sidebar-toggle { display: none; }

  .file-actions { gap: 0.125rem; }
  .file-actions .btn-sm { padding: 0.25rem 0.375rem; font-size: 0.75rem; }

  .modal { max-width: 100%; margin: 0.5rem; }

  .toolbar { padding: 0.375rem 0.75rem; }

  .upload-zone { margin: 0.5rem; padding: 1.5rem 1rem; }

  .breadcrumb-bar { padding: 0.5rem 0.75rem; }
}

@media (max-width: 480px) {
  .top-nav .brand span { display: none; }
  .username-label { display: none; }
}

/* ===== Move Modal Directory Tree ===== */
.move-dir-tree {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e0e0db;
  border-radius: 8px;
  background: #fafaf7;
}

.move-dir-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.9rem;
  color: #2d2d2d;
  border-bottom: 1px solid #f0f0eb;
}

.move-dir-item:last-child { border-bottom: none; }
.move-dir-item:hover { background: #f0f0eb; }
.move-dir-item.selected {
  background: #e8e8ff;
  color: #4a5a8a;
  font-weight: 500;
}

.move-dir-icon { flex-shrink: 0; font-size: 1.1rem; }

.move-dir-loading {
  padding: 2rem;
  text-align: center;
  color: #8a8a8a;
  font-size: 0.875rem;
}
