/* ==========================================
   CloudDrive App Styles (app.css)
   Notion/Figma-inspired minimal aesthetic
   ========================================== */

/* --- Accessibility & reduced effects --- */
.low-effects #particleCanvas,
.low-effects #energyRibbons,
.low-effects #glowOrb,
.low-effects #glowOrb2,
.low-effects #cursorGlow { display: none !important; }

.low-effects .content-inner,
.low-effects .brand-panel::before,
.low-effects .power-ring,
.low-effects .spark-track,
.low-effects .battery-hero,
.low-effects .battery-shine,
.low-effects .battery-core { animation: none !important; }

.low-effects .file-row,
.low-effects .file-card,
.low-effects .summary-card,
.low-effects .chip,
.low-effects .icon-btn,
.low-effects .ghost-btn,
.low-effects .primary-btn { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

/* --- Reset & base --- */
:root { color-scheme: dark; }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }

html, body { height: 100%; background: var(--cd-bg); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--cd-text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button, input { font: inherit; }
button { border: 0; background: none; color: inherit; cursor: pointer; }
a { color: var(--cd-blue); text-decoration: none; }
img, video, canvas, svg { max-width: 100%; }

/* --- Utility classes --- */
.icon { width: 20px; height: 20px; display: block; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; stroke: none; }
.hidden { display: none !important; }
.kbd-safe { word-break: break-word; }
.file-load-sentinel { min-height: 52px; display: grid; place-items: center; color: var(--cd-muted); font-size: 12px; font-weight: 700; }

/* --- Decorative elements (hidden in minimal design) --- */
#particleCanvas { display: none; }
#glowOrb { display: none; }
#glowOrb2 { display: none; }
#cursorGlow { display: none; }
#energyRibbons { display: none; }

/* --- Keyframes (minimal set only) --- */
@keyframes previewFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* --- Login page --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login-shell {
  width: 100%;
  max-width: 1120px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--cd-glass-strong);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.12);
  overflow: hidden;
  animation: fadeIn .25s ease-out;
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 48px 40px;
  background: var(--cd-surface);
  border-right: 1px solid var(--cd-line);
}

.brand-panel::before { display: none; }
.brand-panel::after { display: none; }

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .01em;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--cd-blue);
  color: #fff;
}

.brand-copy { position: relative; }
.brand-copy h1 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -.02em;
  font-weight: 700;
  color: var(--cd-text);
  -webkit-text-fill-color: var(--cd-text);
  background: none;
}
.brand-copy p { font-size: 14px; line-height: 1.6; color: var(--cd-muted); max-width: 360px; }

.brand-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.brand-stat {
  background: var(--cd-brand-stat-bg);
  border: 1px solid var(--cd-brand-stat-border);
  border-radius: var(--cd-radius-sm);
  padding: 12px;
  transition: background .15s;
}
.brand-stat:hover { background: var(--cd-brand-stat-hover); }
.brand-stat strong { display: block; font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.brand-stat span { font-size: 12px; color: var(--cd-muted); }

.auth-panel { padding: 32px 28px; display: flex; align-items: center; }
.auth-card { width: 100%; }
.auth-card h2 { font-size: 22px; letter-spacing: -.01em; margin-bottom: 4px; font-weight: 700; }
.auth-card .sub { font-size: 13px; color: var(--cd-muted); margin-bottom: 20px; }

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  background: var(--cd-segmented-bg);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius-sm);
  margin-bottom: 20px;
}
.segmented button {
  min-width: 84px;
  height: 34px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--cd-muted);
  font-weight: 600;
  transition: all .15s;
}
.segmented button.active {
  background: var(--cd-surface);
  color: var(--cd-text);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--cd-muted);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: .02em;
}

.input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius-sm);
  background: var(--cd-input-bg);
  padding: 0 12px;
  font-size: 14px;
  outline: 0;
  color: var(--cd-text);
  transition: border .15s, box-shadow .15s;
}
.input:focus {
  border-color: var(--cd-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
  background: var(--cd-input-bg-focus);
}
.input::placeholder { color: var(--cd-subtle); }

/* --- Buttons --- */
.primary-btn, .ghost-btn, .danger-btn {
  height: 38px;
  border-radius: var(--cd-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: all .15s;
}

.primary-btn {
  background: var(--cd-blue);
  color: #fff;
  padding: 0 16px;
}
.primary-btn:hover { background: #2563eb; }

.ghost-btn {
  background: var(--cd-btn-ghost-bg);
  border: 1px solid var(--cd-line);
  color: var(--cd-text);
  padding: 0 14px;
}
.ghost-btn:hover { background: var(--cd-btn-ghost-hover); }

.danger-btn {
  background: rgba(239,68,68,.08);
  color: var(--cd-red);
  padding: 0 14px;
}
.danger-btn:hover { background: rgba(239,68,68,.14); }

.primary-btn:active, .ghost-btn:active, .danger-btn:active,
.icon-btn:active, .nav-tab:active, .file-row:active, .file-card:active {
  opacity: .8;
}

.full-btn { width: 100%; margin-top: 8px; }

/* --- App shell --- */
.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.app-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* --- Sidebar --- */
.sidebar {
  min-height: 0;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--cd-glass-sidebar);
  border-right: 1px solid var(--cd-line);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
}
.side-brand .brand-logo { width: 32px; height: 32px; border-radius: 8px; }
.side-brand strong { font-size: 15px; font-weight: 700; }
.side-brand span { display: block; font-size: 11px; color: var(--cd-muted); margin-top: 2px; }

.side-section { display: grid; gap: 2px; }

.side-label {
  font-size: 11px;
  color: var(--cd-subtle);
  font-weight: 600;
  padding: 6px 10px 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.side-nav {
  height: 36px;
  border-radius: var(--cd-radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--cd-muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background .15s, color .15s;
}
.side-nav .icon { width: 18px; height: 18px; }
.side-nav.active { background: var(--cd-blue-soft); color: var(--cd-blue); font-weight: 600; }
.side-nav:hover:not(.active) { background: var(--cd-icon-btn-hover); color: var(--cd-text); }

.side-spacer { flex: 1; }

.side-user {
  border-top: 1px solid var(--cd-line);
  padding-top: 12px;
  color: var(--cd-muted);
  font-size: 12px;
  line-height: 1.7;
}

/* --- Topbar --- */
.topbar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--cd-glass-topbar);
  border-bottom: 1px solid var(--cd-border-faint);
  position: relative;
  z-index: 20;
}

.top-title { flex: 1; min-width: 0; }
.top-title strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-title span {
  display: block;
  font-size: 11px;
  color: var(--cd-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.top-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--cd-radius-sm);
  display: grid;
  place-items: center;
  background: var(--cd-icon-btn-bg);
  border: 1px solid var(--cd-line);
  color: var(--cd-text);
  transition: background .15s;
}
.icon-btn:hover:not(.primary):not(.danger) { background: var(--cd-icon-btn-hover); }
.icon-btn.primary { background: var(--cd-blue); color: #fff; border-color: transparent; }
.icon-btn.primary:hover { opacity: .9; }
.icon-btn.danger { background: rgba(239,68,68,.08); color: var(--cd-red); }

/* --- Search --- */
.search-panel {
  padding: 8px 16px;
  background: var(--cd-search-panel-bg);
  border-bottom: 1px solid var(--cd-line);
  position: relative;
  z-index: 15;
}

.search-box {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cd-search-box-bg);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius-sm);
  padding: 0 12px;
  transition: border .15s;
}
.search-box:focus-within { border-color: var(--cd-blue); }
.search-box input {
  border: 0; outline: 0; flex: 1; min-width: 0;
  color: var(--cd-text); background: transparent; font-size: 13px;
}
.search-box input::placeholder { color: var(--cd-subtle); }

/* --- Content area --- */
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 20px 32px;
  position: relative;
  will-change: scroll-position;
  contain: layout style;
}

.content-inner {
  width: min(1160px, 100%);
  margin: 0 auto;
  animation: fadeIn .2s ease-out;
}

/* --- Summary cards --- */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }

.summary-card {
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  padding: 16px;
  cursor: default;
  transition: border-color .15s;
  position: relative;
  overflow: hidden;
  contain: layout style;
  content-visibility: auto;
  contain-intrinsic-size: 100px;
}
.summary-card:hover { border-color: var(--cd-line-strong); }
.summary-card b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.summary-card span { display: block; color: var(--cd-muted); font-size: 12px; font-weight: 500; }
.summary-card.blue b { color: var(--cd-blue); }
.summary-card.green b { color: var(--cd-green); }
.summary-card.orange b { color: var(--cd-orange); }
.summary-card.purple b { color: var(--cd-purple); }

/* --- Category chips --- */
.category-strip { display: flex; gap: 8px; overflow: auto; padding: 2px 0 14px; scrollbar-width: none; }
.category-strip::-webkit-scrollbar { display: none; }

.chip {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 12px;
  border-radius: var(--cd-radius-sm);
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  color: var(--cd-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.chip:hover:not(.active) { border-color: var(--cd-line-strong); }
.chip.active { background: var(--cd-blue); border-color: var(--cd-blue); color: #fff; }

/* --- Workspace hero --- */
.workspace-hero {
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  padding: 18px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}
.workspace-title h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-title p { color: var(--cd-muted); font-size: 12px; margin-top: 4px; }
.workspace-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* --- Toolbar --- */
.toolbar { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin: 4px 0 12px; }
.toolbar-left { min-width: 0; }
.eyebrow { font-size: 11px; color: var(--cd-subtle); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.breadcrumb { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--cd-view-toggle-bg);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius-sm);
  padding: 2px;
  flex-shrink: 0;
}
.view-toggle button {
  width: 32px;
  height: 28px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--cd-muted);
  transition: all .15s;
}
.view-toggle button.active { background: var(--cd-surface); color: var(--cd-blue); }

/* --- File list & grid --- */
.file-list { display: grid; gap: 2px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }

.file-row, .file-card, .action-row, .tag-result, .upload-row, .ai-result {
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
}

.file-row {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background .15s;
  contain: layout style;
  content-visibility: auto;
  contain-intrinsic-size: 56px;
}
.file-row:hover { background: var(--cd-surface-elevated); }

.file-card {
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s;
  contain: layout style;
  content-visibility: auto;
  contain-intrinsic-size: 220px;
}
.file-card:hover { border-color: var(--cd-line-strong); }

.file-card-thumb {
  height: 148px;
  background: var(--cd-file-thumb-bg);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.file-card-thumb img, .thumb { width: 100%; height: 100%; object-fit: cover; display: block; }

.file-card-body { padding: 10px; }

.file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  min-height: 36px;
}
.file-card-meta, .file-meta { font-size: 12px; color: var(--cd-muted); margin-top: 4px; }

.file-info { flex: 1; min-width: 0; }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* --- Tile icons --- */
.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  font-weight: 700;
  position: relative;
  overflow: hidden;
}
.file-card .tile-icon { width: 48px; height: 48px; }
.file-card-thumb > .tile-icon { width: 48px; height: 48px; }
.file-card-thumb > img, .tile-icon .thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.folder-icon { background: #f59e0b; }
.image-icon { background: #3b82f6; }
.video-icon { background: #ef4444; }
.audio-icon { background: #8b5cf6; }
.doc-icon { background: #10b981; }
.code-icon { background: #06b6d4; }
.archive-icon { background: #78716c; }

.badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  background: var(--cd-badge-bg);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

/* --- Empty state --- */
.empty-state {
  min-height: 240px;
  background: var(--cd-empty-bg);
  border-color: var(--cd-empty-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--cd-muted);
  padding: 28px;
}
.empty-state strong { color: var(--cd-text); font-size: 15px; margin: 12px 0 4px; }

/* --- Bottom navigation --- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(56px + var(--cd-safe-bottom));
  padding: 6px 12px var(--cd-safe-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--cd-glass-sidebar);
  border-top: 1px solid var(--cd-line);
  z-index: 30;
}

.nav-tab {
  border-radius: var(--cd-radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--cd-muted);
  font-size: 10px;
  font-weight: 600;
  transition: color .15s, background .15s;
}
.nav-tab .icon { width: 20px; height: 20px; }
.nav-tab.active { background: var(--cd-blue-soft); color: var(--cd-blue); }

/* --- FAB (simple, no animation) --- */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(72px + var(--cd-safe-bottom));
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--cd-blue);
  color: #fff;
  z-index: 25;
  transition: opacity .15s;
}
.fab:hover { opacity: .9; }

/* --- Page panels --- */
.page-panel {
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  padding: 18px;
  margin-bottom: 12px;
}

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 17px; font-weight: 700; }
.panel-head span { font-size: 12px; color: var(--cd-muted); }

.action-list { display: grid; gap: 6px; }

.action-row {
  min-height: 56px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.action-row:hover { background: var(--cd-card-hover-bg); }
.action-row .tile-icon { width: 38px; height: 38px; }
.action-row b { display: block; font-size: 13px; font-weight: 600; }
.action-row span { display: block; color: var(--cd-muted); font-size: 12px; margin-top: 2px; }

/* --- Profile --- */
.profile-hero { display: flex; align-items: center; gap: 14px; }

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--cd-blue);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}
.profile-hero h2 { font-size: 18px; font-weight: 700; }
.profile-hero p { font-size: 12px; color: var(--cd-muted); margin-top: 2px; }

/* --- Upload --- */
.upload-zone {
  min-height: 160px;
  border: 1.5px dashed var(--cd-line-strong);
  border-radius: var(--cd-radius);
  background: var(--cd-upload-zone-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 28px;
  transition: border-color .15s, background .15s;
}
.upload-zone.drag { border-color: var(--cd-blue); background: rgba(59,130,246,.04); }

.upload-list { display: grid; gap: 8px; margin-top: 12px; }

.upload-row {
  padding: 12px;
  display: grid;
  gap: 8px;
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
}
.upload-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.progress { height: 4px; border-radius: 999px; background: var(--cd-progress-bg); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--cd-blue); border-radius: 999px; transition: width .3s; }

/* --- Smart / AI section --- */
.smart-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 12px; }
.smart-list { display: grid; gap: 8px; }

.tag-result, .ai-result, .smart-card {
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  padding: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: border-color .15s;
}
.tag-result:hover, .ai-result:hover, .smart-card:hover { border-color: var(--cd-line-strong); }
.tag-result img, .ai-result img, .smart-card img {
  width: 56px; height: 56px; border-radius: 6px; object-fit: cover;
  background: #1a2130; flex-shrink: 0;
}
.tag-result b, .ai-result b, .smart-card b { display: block; font-size: 13px; line-height: 1.4; word-break: break-word; font-weight: 600; }
.tag-result span, .ai-result span, .smart-card span { display: block; font-size: 12px; color: var(--cd-muted); margin-top: 3px; line-height: 1.5; }

.ai-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.ai-chip {
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--cd-icon-btn-bg);
  color: var(--cd-muted);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.ai-chip.blue { background: var(--cd-blue-soft); color: var(--cd-blue); }
.ai-chip.green { background: rgba(16,185,129,.1); color: var(--cd-green); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- Preview overlay --- */
.preview-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
  background: var(--cd-preview-bg);
  color: var(--cd-preview-text);
  opacity: 0;
}
.preview-overlay.show {
  display: flex;
  flex-direction: column;
  animation: previewFadeIn .15s ease-out forwards;
}

.preview-top, .preview-bottom {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  flex-shrink: 0;
}

.preview-name {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--cd-preview-text);
}

.preview-body {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  position: relative;
}
.preview-body img, .preview-body video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  animation: previewFadeIn .2s ease-out;
}
.preview-body iframe {
  width: min(100%, 1120px);
  height: 100%;
  border: 0;
  border-radius: 6px;
  background: #111;
}
.preview-body pre {
  max-width: min(100%, 980px);
  max-height: 100%;
  overflow: auto;
  background: #0d1117;
  border: 1px solid var(--cd-line);
  border-radius: 6px;
  padding: 18px;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.7;
}

.preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--cd-preview-nav-bg);
  display: grid;
  place-items: center;
  color: var(--cd-preview-text);
  transition: background .15s;
}
.preview-nav:hover { background: var(--cd-preview-nav-hover); }
.preview-nav.left { left: 14px; }
.preview-nav.right { right: 14px; }

.preview-bottom { justify-content: center; }
.preview-bottom .ghost-btn {
  background: var(--cd-preview-btn-bg);
  border-color: var(--cd-preview-btn-border);
  color: var(--cd-preview-text);
}

/* --- Toast notifications --- */
.toast-container {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 130;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  max-width: min(88vw, 420px);
  animation: fadeIn .2s ease-out;
}
.toast.info { background: var(--cd-toast-info-bg); border: 1px solid var(--cd-toast-info-border); }
.toast.ok { background: var(--cd-green); border: 1px solid rgba(16,185,129,.3); }
.toast.err { background: var(--cd-red); border: 1px solid rgba(239,68,68,.3); }

/* --- Modal --- */
.modal-root {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--cd-modal-bg);
  z-index: 120;
  padding: 24px;
}
.modal-root.show { display: flex; }

.modal {
  width: min(420px, 100%);
  background: var(--cd-surface-elevated);
  border-radius: var(--cd-radius);
  border: 1px solid var(--cd-line);
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  padding: 22px;
  animation: fadeIn .2s ease-out;
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.modal p { font-size: 13px; color: var(--cd-muted); line-height: 1.6; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* --- Spinner --- */
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--cd-spinner-border);
  border-top-color: var(--cd-blue);
  animation: spin .7s linear infinite;
  margin: 80px auto;
}

/* --- Cloud card nav (hidden - removed in minimal design) --- */
.cloud-card-shell { display: none; }
.cloud-card-nav-container { display: none; }
.cloud-card-nav { display: none; }
.cloud-card-brand { display: none; }
.cloud-card-brand-mark { display: none; }
.cloud-card-content { display: none; }
.cloud-card-cta { display: none; }
.cloud-card-link { display: none; }
.cloud-hamburger { display: none; }
.cloud-card-link-label { display: none; }
.cloud-card-link-icon { display: none; }

/* --- Decorative elements from original (all hidden) --- */
.power-stage { display: none; }
.power-ring { display: none; }
.spark-track { display: none; }
.battery-hero { display: none; }
.battery-cap { display: none; }
.battery-body { display: none; }
.battery-shine { display: none; }
.battery-core { display: none; }
.battery-label { display: none; }

/* --- Avatar & nickname --- */
.avatar-wrap { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.avatar-img {
  width: 64px; height: 64px; border-radius: 12px;
  object-fit: cover; display: block;
  background: var(--cd-surface-elevated);
  border: 2px solid var(--cd-line);
}
.avatar-upload {
  position: absolute; inset: 0; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(0,0,0,.4); opacity: 0; cursor: pointer;
  transition: opacity .15s;
}
.avatar-wrap:hover .avatar-upload { opacity: 1; }
.avatar-upload span { color: #fff; font-size: 11px; font-weight: 600; }

.nickname-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.nickname-text { font-size: 16px; font-weight: 700; }
.nickname-input {
  height: 32px; border: 1px solid var(--cd-blue); border-radius: 4px;
  background: var(--cd-input-bg); color: var(--cd-text);
  padding: 0 10px; font-size: 13px; outline: none; width: 150px;
}
.nickname-input:focus { box-shadow: 0 0 0 2px var(--cd-blue-soft); }
.edit-nick-btn {
  width: 28px; height: 28px; border-radius: 4px;
  display: grid; place-items: center;
  background: var(--cd-icon-btn-bg); color: var(--cd-muted);
  cursor: pointer; transition: background .15s; border: 0;
}
.edit-nick-btn:hover { background: var(--cd-icon-btn-hover); color: var(--cd-text); }

/* --- Preview editing mode --- */
.preview-overlay.editing .preview-bottom { display: none; }
.preview-overlay.editing .preview-body {
  align-items: stretch;
  justify-items: center;
  padding: 10px 16px 16px;
  overflow: hidden;
}
.preview-overlay.editing #previewContent {
  width: 100%; height: 100%; min-height: 0;
  display: grid; place-items: center;
}
.preview-overlay.editing .preview-nav { opacity: .4; }
.preview-overlay.editing .preview-nav:hover { opacity: 1; }

/* --- Share float --- */
.share-float {
  position: absolute; right: 8px; top: 8px;
  width: 32px; height: 32px;
  background: rgba(0,0,0,.4);
  border-color: rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .15s;
}
.file-card:hover .share-float { opacity: 1; }

/* --- File context menu --- */
.file-context-menu {
  position: fixed;
  z-index: 160;
  width: 170px;
  padding: 6px;
  border-radius: 8px;
  background: var(--cd-surface-elevated);
  border: 1px solid var(--cd-line-strong);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  display: grid;
  gap: 2px;
  animation: fadeIn .12s ease-out;
}
.file-context-menu button {
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--cd-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  background: transparent;
}
.file-context-menu button:hover { background: var(--cd-icon-btn-hover); }
.file-context-menu button.danger { color: var(--cd-red); }
.file-context-menu .icon { width: 16px; height: 16px; }

/* --- Share target --- */
.share-target {
  display: grid; gap: 6px;
  border: 1px solid var(--cd-line); border-radius: 8px;
  background: var(--cd-input-bg); padding: 10px; min-width: 0;
}
.share-target b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.share-target span { font-size: 12px; color: var(--cd-muted); word-break: break-all; line-height: 1.5; }

.transfer-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--cd-muted); font-size: 11px; font-weight: 600; }
.transfer-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Theme toggle --- */
.theme-toggle-icon { transition: transform .2s; }
#themeToggle.active .theme-toggle-icon { transform: rotate(180deg); }
#themeToggleTop .icon { width: 20px; height: 20px; }

/* --- Brand logo image --- */
.brand-logo.brand-logo-image, .cloud-card-brand-mark.brand-logo-image {
  background: transparent !important;
  box-shadow: none !important;
}
.brand-logo-img { width: 100%; height: 100%; display: block; object-fit: contain; }

/* --- Photo editor --- */
.photo-editor {
  width: min(1220px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.editor-main {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 10px;
}

.editor-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.2);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  padding: 12px;
  overflow: hidden;
}
.editor-stage canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  background: #111;
}

.editor-panel {
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}
.editor-panel h3 { font-size: 14px; font-weight: 700; }

.editor-group { display: grid; gap: 8px; border-top: 1px solid var(--cd-line); padding-top: 10px; }
.editor-group:first-child { border-top: 0; padding-top: 0; }
.editor-group-title { font-size: 11px; color: var(--cd-subtle); font-weight: 700; text-transform: uppercase; }

.editor-control { display: grid; gap: 5px; }
.editor-control label { display: flex; justify-content: space-between; color: var(--cd-muted); font-size: 12px; font-weight: 600; }
.editor-control input[type=range] { width: 100%; accent-color: var(--cd-blue); }

.editor-strip {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  background: var(--cd-surface);
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  padding: 8px;
  overflow: auto;
}

.preset-list { display: flex; gap: 6px; }
.preset-btn {
  height: 34px;
  border-radius: 6px;
  padding: 0 11px;
  background: var(--cd-icon-btn-bg);
  border: 1px solid var(--cd-line);
  color: var(--cd-text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.preset-btn.active { background: var(--cd-blue-soft); border-color: var(--cd-blue); color: var(--cd-blue); }

.editor-actions { display: flex; gap: 6px; align-items: center; }
.editor-actions .ghost-btn, .editor-actions .primary-btn { height: 34px; padding: 0 10px; font-size: 12px; }
.editor-tip { font-size: 12px; line-height: 1.5; color: var(--cd-muted); }

.compare-on .editor-stage canvas { opacity: .85; }
.editor-mini-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

/* ==========================================
   Hotfix 0.0.68 (merged)
   ========================================== */

/* --- LRC editor page --- */
.lrc-page {
  width: min(1560px, 100%);
  height: calc(100dvh - 116px);
  min-height: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  color: var(--cd-text);
}

.lrc-page-top {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  background: var(--cd-surface);
}

.lrc-page-title { min-width: 0; display: grid; gap: 2px; }
.lrc-page-title b {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 14px; font-weight: 700;
}
.lrc-page-title span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--cd-muted); font-size: 12px;
}

.lrc-page-actions {
  display: flex; align-items: center;
  justify-content: flex-end; gap: 6px; min-width: 0;
}
.lrc-page-actions .ghost-btn,
.lrc-page-actions .primary-btn { height: 34px; padding: 0 10px; font-size: 12px; }

.lrc-page-body {
  min-height: 0; overflow: hidden;
  border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius);
  background: rgba(0,0,0,.12);
  padding: 10px;
}

.lrc-page .lrc-editor,
.preview-overlay.editing .lrc-editor {
  width: 100%; height: 100%; min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
}
.lrc-page .lrc-main,
.preview-overlay.editing .lrc-main {
  height: 100%; min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 342px);
  align-items: stretch;
}
.lrc-page .lrc-stage,
.preview-overlay.editing .lrc-stage {
  height: 100%; min-height: 0;
  contain: layout paint size;
}
.lrc-page .lrc-panel,
.preview-overlay.editing .lrc-panel {
  height: 100%; min-height: 0; max-height: none;
  overflow: auto; overscroll-behavior: contain;
}
.lrc-page .lrc-strip,
.preview-overlay.editing .lrc-strip {
  min-height: 52px; max-width: 100%; overflow: hidden;
}
.lrc-page .lrc-modules,
.lrc-page .lrc-preset-row,
.lrc-page .lrc-action-row,
.preview-overlay.editing .lrc-modules,
.preview-overlay.editing .lrc-preset-row,
.preview-overlay.editing .lrc-action-row {
  min-width: 0; scrollbar-width: none;
}

/* --- Retouch status --- */
.retouch-status {
  border: 1px solid var(--cd-line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--cd-muted);
  background: var(--cd-icon-btn-bg);
}
.retouch-status.err {
  color: var(--cd-red);
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.18);
}
.retouch-status.info {
  color: var(--cd-blue);
  background: var(--cd-blue-soft);
  border-color: rgba(59,130,246,.15);
}

/* ==========================================
   Responsive Polish (merged)
   ========================================== */

:root {
  --cd-page-max: 1440px;
  --cd-work-max: 1280px;
  --cd-readable: 760px;
  --cd-space: clamp(12px, 1.6vw, 24px);
  --cd-space-lg: clamp(18px, 2.6vw, 40px);
  --cd-radius-pro: clamp(10px, 1vw, 14px);
  --cd-control: clamp(38px, 4.4vw, 44px);
}

/* --- Desktop (min-width: 821px) --- */
@media (min-width: 821px) {
  .bottom-nav { display: none; }
  .fab { display: none !important; }
  .content { padding-inline: clamp(18px, 2vw, 30px); }
  .sidebar { width: clamp(220px, 19vw, 260px); }
  .photo-editor { width: min(1220px, 100%); }
}

/* --- Tablet landscape (max-width: 1120px) --- */
@media (max-width: 1120px) {
  .workspace-hero { grid-template-columns: 1fr; }
  .smart-grid, .panel-grid { grid-template-columns: 1fr !important; }
}

/* --- Tablet (max-width: 980px) --- */
@media (max-width: 980px) {
  .photo-editor { height: auto; min-height: 100%; }
  .editor-main { grid-template-columns: 1fr; }
  .editor-panel { order: 2; max-height: 42vh; }
  .editor-strip { position: sticky; bottom: 0; z-index: 2; }
  .editor-actions { min-width: max-content; }
}

/* --- Tablet portrait (max-width: 900px) --- */
@media (max-width: 900px) {
  .editor-main, .lrc-main, .retouch-main { grid-template-columns: 1fr !important; }
  .editor-panel, .lrc-panel, .retouch-panel { max-height: min(44dvh, 390px); overflow: auto; }
}

/* --- Mobile (max-width: 820px) --- */
@media (max-width: 820px) {
  body { overflow: hidden; }
  .login-page { min-height: 100dvh; padding: 20px; }
  .login-shell {
    display: block; min-height: 0;
    width: min(420px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    max-height: none;
    min-width: 0;
  }
  .brand-panel { display: none; }
  .auth-panel {
    display: block;
    padding: clamp(24px, 7vw, 32px) clamp(18px, 5vw, 24px);
    min-width: 0; width: 100%; max-width: 100%;
  }
  .auth-card { min-width: 0; overflow: hidden; }
  .auth-card form { width: 100%; max-width: 100%; overflow: hidden; }

  .app { display: flex; flex-direction: column; height: 100dvh; }
  .sidebar { display: none; }
  .app-main { flex: 1; min-height: 0; }

  .topbar { height: 52px; min-height: 52px; padding: 0 12px; }
  .top-actions { gap: 4px; }
  .icon-btn { width: 36px; height: 36px; }

  .content { padding: 14px 12px calc(80px + var(--cd-safe-bottom)); max-width: 100%; }
  .content-inner { max-width: 680px; }

  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .file-card-thumb { height: auto; aspect-ratio: 1; }
  .file-actions .icon-btn { width: 34px; height: 34px; }

  .workspace-hero { grid-template-columns: 1fr; }
  .workspace-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
  .workspace-actions > * { min-height: var(--cd-control); }
  .workspace-hero, .page-panel, .upload-zone { border-radius: 12px; }

  .smart-grid { grid-template-columns: 1fr; }

  .bottom-nav { padding-bottom: max(6px, env(safe-area-inset-bottom, 0px)); }
  .bottom-nav span { font-size: 10px; }

  .context-menu { left: 12px !important; right: 12px; width: auto; max-width: none; }

  .preview-overlay.editing .preview-top { height: 48px; }
  .preview-overlay.editing .preview-body { padding: 8px; }
  .preview-overlay.editing .preview-nav { width: 36px; height: 36px; }
}

/* --- LRC responsive (max-width: 1080px) --- */
@media (max-width: 1080px) {
  .lrc-page { height: calc(100dvh - 108px); min-height: 0; }
  .lrc-page .lrc-editor,
  .preview-overlay.editing .lrc-editor {
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .lrc-page .lrc-main,
  .preview-overlay.editing .lrc-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(42vh, 1fr) minmax(210px, 34vh);
  }
  .lrc-page .lrc-panel,
  .preview-overlay.editing .lrc-panel { order: 2; max-height: 34vh; }
  .lrc-page .lrc-stage,
  .preview-overlay.editing .lrc-stage { min-height: 42vh; }
  .lrc-page .lrc-strip,
  .preview-overlay.editing .lrc-strip { grid-template-columns: 1fr; gap: 8px; }
  .lrc-page .lrc-action-row,
  .preview-overlay.editing .lrc-action-row { overflow: auto; padding-bottom: 2px; }
  .retouch-layout { grid-template-columns: 1fr; }
  .retouch-inspector { grid-column: auto; }
  .retouch-hero { grid-template-columns: 1fr; }
  .retouch-hero-actions { justify-content: flex-start; }
  .retouch-panel { min-width: 0; }
  .retouch-folder-tree { max-height: 240px; }
}

/* --- Small mobile (max-width: 620px) --- */
@media (max-width: 620px) {
  .lrc-page {
    height: calc(100dvh - 152px - var(--cd-safe-bottom));
    gap: 8px;
  }
  .lrc-page-top { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .lrc-page-actions { grid-column: 1 / -1; justify-content: stretch; overflow: auto; }
  .lrc-page-actions .ghost-btn,
  .lrc-page-actions .primary-btn { flex: 1; min-width: 78px; }
  .lrc-page-body,
  .preview-overlay.editing .preview-body { padding: 6px; }
  .lrc-page .lrc-editor,
  .preview-overlay.editing .lrc-editor { gap: 6px; }
  .lrc-page .lrc-main,
  .preview-overlay.editing .lrc-main {
    grid-template-rows: minmax(35vh, 1fr) minmax(220px, 38vh);
    gap: 6px;
  }
  .lrc-page .lrc-stage,
  .preview-overlay.editing .lrc-stage { min-height: 35vh; border-radius: 8px; }
  .lrc-page .lrc-panel,
  .preview-overlay.editing .lrc-panel { max-height: 38vh; padding: 10px; border-radius: 8px; }
  .lrc-page .lrc-strip,
  .preview-overlay.editing .lrc-strip { position: relative; bottom: auto; padding: 8px; border-radius: 8px; }
  .lrc-page .lrc-module,
  .preview-overlay.editing .lrc-module { height: 36px; min-width: 56px; }
  .lrc-page .lrc-action-row,
  .preview-overlay.editing .lrc-action-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(74px, 1fr));
    overflow: auto;
  }
  .lrc-page .lrc-action-row .ghost-btn,
  .lrc-page .lrc-action-row .primary-btn,
  .preview-overlay.editing .lrc-action-row .ghost-btn,
  .preview-overlay.editing .lrc-action-row .primary-btn { height: 34px; padding: 0 8px; }
  .retouch-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retouch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retouch-hero, .retouch-panel { padding: 12px; }
  .retouch-row-actions, .retouch-actions, .retouch-hero-actions {
    width: 100%; justify-content: stretch;
  }
  .retouch-row-actions .ghost-btn,
  .retouch-actions .ghost-btn,
  .retouch-actions .primary-btn,
  .retouch-hero-actions .ghost-btn,
  .retouch-hero-actions .primary-btn { flex: 1; min-width: 0; }
  .retouch-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Small phone (max-width: 560px) --- */
@media (max-width: 560px) {
  .preset-list { min-width: max-content; }
  .editor-strip { align-items: flex-start; flex-direction: column; }
  .editor-actions { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .editor-actions .ghost-btn, .editor-actions .primary-btn { padding: 0 8px; }

  .top-title strong { font-size: 14px; }
  .top-title span { font-size: 11px; }
  .icon-btn { width: 36px; height: 36px; flex: 0 0 36px; }
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-card-body { padding: 8px; }
  .file-card-name { font-size: 12px; }
  .summary-card { min-width: 0; padding: 12px; }
  .summary-card b { font-size: clamp(18px, 6vw, 24px); }
  .workspace-title h2 { font-size: 20px; }
  .workspace-actions .ghost-btn, .workspace-actions .primary-btn,
  .btn, .ghost-btn, .primary-btn { min-height: 40px; }
  .editor-actions { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  h1 { white-space: normal; }
}

/* --- Extra small (max-width: 380px) --- */
@media (max-width: 380px) {
  .file-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .bottom-nav span { display: none; }
}

/* --- Reduced motion (merged) --- */
@media (prefers-reduced-motion: reduce) {
  .brand-logo.brand-logo-image, .cloud-card-brand-mark.brand-logo-image {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .brand-logo-img {
    width: 100%; height: 100%;
    display: block; object-fit: contain;
  }
}

/* ==========================================
   v0.0.57 — New Features Styles
   ========================================== */

/* --- Search Results & History --- */
.search-results { max-height: 360px; overflow-y: auto; padding: 4px 0; }
.search-result-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-radius: 8px; transition: background .15s; }
.search-result-item:hover { background: var(--cd-btn-ghost-hover); }
.search-result-item .search-thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.search-result-info b { display: block; font-size: 13px; font-weight: 600; }
.search-result-info span { font-size: 11px; color: var(--cd-muted); }
.search-result-info mark { background: var(--cd-blue-soft); color: var(--cd-blue); border-radius: 2px; padding: 0 2px; }
.search-empty { padding: 24px; text-align: center; color: var(--cd-muted); font-size: 13px; }
.search-mode-btn { background: var(--cd-btn-ghost-bg); border: none; color: var(--cd-muted); font-size: 11px; padding: 3px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.search-mode-btn:hover { background: var(--cd-btn-ghost-hover); }
.search-history { padding: 4px 0; }
.search-history-title { padding: 6px 12px; font-size: 11px; color: var(--cd-subtle); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.search-history-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; font-size: 13px; color: var(--cd-muted); border-radius: 6px; }
.search-history-item:hover { background: var(--cd-btn-ghost-hover); color: var(--cd-text); }
.search-history-item svg { width: 14px; height: 14px; opacity: .5; }

/* --- File Selection --- */
.file-check { display: flex; align-items: center; padding-right: 4px; }
.file-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--cd-blue); cursor: pointer; }
.file-check-card { position: absolute; top: 6px; left: 6px; z-index: 2; }
.file-check-card input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--cd-blue); cursor: pointer; }
.file-row.selected, .file-card.selected { background: var(--cd-blue-soft); border-color: var(--cd-blue); }
.star-btn { color: var(--cd-muted); }
.star-btn:hover { color: var(--cd-orange); }

/* --- Sort & Toolbar --- */
.toolbar-right { display: flex; align-items: center; gap: 4px; }
.select-group { display: flex; align-items: center; gap: 2px; background: var(--cd-input-bg); border-radius: 6px; padding: 2px; }
.select-group .toolbar-btn { border-radius: 4px; font-size: 11px; padding: 3px 8px; gap: 3px; white-space: nowrap; }
.select-group .toolbar-btn.active { background: var(--cd-blue); color: #fff; }
.toolbar-btn { background: none; border: none; color: var(--cd-muted); padding: 4px 6px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; font-size: 12px; }
.toolbar-btn:hover { background: var(--cd-btn-ghost-hover); color: var(--cd-text); }
.toolbar-btn.active { color: var(--cd-blue); background: var(--cd-blue-soft); }
.file-context-menu button.active { color: var(--cd-blue); }

/* --- Drag Overlay --- */
.drag-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); display: grid; place-items: center; }
.drag-overlay-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #fff; }
.drag-overlay-inner svg { width: 48px; height: 48px; opacity: .8; }
.drag-overlay-inner strong { font-size: 20px; }
.drag-overlay-inner span { font-size: 14px; opacity: .7; }

/* --- Detail Panel --- */
.detail-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 320px; z-index: 100; background: var(--cd-glass-strong); backdrop-filter: blur(20px); border-left: 1px solid var(--cd-line); transform: translateX(100%); transition: transform .3s cubic-bezier(.34,1.56,.64,1); overflow-y: auto; }
.detail-panel:not(.hidden) { transform: translateX(0); }
.detail-panel-inner { padding: 16px; }
.detail-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.detail-header b { font-size: 14px; }
.detail-thumb { width: 100%; border-radius: 10px; overflow: hidden; margin-bottom: 12px; background: var(--cd-surface); display: grid; place-items: center; min-height: 120px; }
.detail-thumb img { width: 100%; max-height: 200px; object-fit: contain; }
.detail-name { font-size: 15px; font-weight: 700; margin-bottom: 12px; word-break: break-all; }
.detail-meta { display: grid; gap: 8px; margin-bottom: 16px; }
.detail-meta > div { display: flex; justify-content: space-between; font-size: 13px; }
.detail-meta span { color: var(--cd-muted); }
.detail-ai { background: var(--cd-surface); border-radius: 10px; padding: 12px; margin-bottom: 16px; }
.detail-ai-title { font-size: 12px; font-weight: 600; color: var(--cd-blue); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.detail-ai-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--cd-line); }
.detail-ai-row span { color: var(--cd-muted); }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions .primary-btn, .detail-actions .ghost-btn { flex: 1; min-width: 0; justify-content: center; }

/* --- Storage Bar --- */
.side-storage { padding: 8px 12px; }
.storage-bar { height: 4px; background: var(--cd-progress-bg); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.storage-fill { height: 100%; background: linear-gradient(90deg, var(--cd-blue), var(--cd-cyan)); border-radius: 2px; transition: width .4s; }
.storage-info { display: flex; justify-content: space-between; font-size: 10px; color: var(--cd-subtle); }

/* --- Keyboard Shortcuts --- */
.shortcut-list { display: grid; gap: 8px; margin: 12px 0; }
.shortcut-row { display: flex; align-items: center; gap: 12px; }
.shortcut-row kbd { background: var(--cd-surface); border: 1px solid var(--cd-line); border-radius: 4px; padding: 2px 8px; font-size: 12px; font-family: var(--cd-font-mono); min-width: 80px; text-align: center; }
.shortcut-row span { font-size: 13px; color: var(--cd-muted); }

/* --- Empty State Enhancement --- */
.empty-state .primary-btn { margin-top: 12px; }

/* --- Image Zoom --- */
.pv-img-zoom { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .2s ease; cursor: zoom-in; }

/* --- Glass Panel Effect --- */
.glass-panel { background: rgba(255,255,255,.72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border: 1px solid rgba(255,255,255,.2); border-radius: 18px; }
[data-theme="dark"] .glass-panel { background: rgba(37,37,37,.85); border-color: rgba(255,255,255,.06); }

/* --- Skeleton Loading --- */
.skeleton { background: linear-gradient(90deg, var(--cd-surface) 25%, var(--cd-surface-elevated) 50%, var(--cd-surface) 75%); background-size: 200% 100%; animation: skeleton-pulse 1.5s ease-in-out infinite; border-radius: 6px; }
@keyframes skeleton-pulse { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 160px; border-radius: 10px; }
.skeleton-row { height: 48px; margin-bottom: 4px; }

/* --- Spring Animation --- */
.spring-in { animation: spring-in .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes spring-in { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* --- Batch Action Bar --- */
.batch-bar { position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 14px; background: var(--cd-glass-strong); backdrop-filter: blur(16px); border: 1px solid var(--cd-line); box-shadow: 0 4px 24px rgba(0,0,0,.3); }
.batch-bar .batch-count { font-size: 13px; font-weight: 600; margin-right: 8px; }

/* --- Detail Panel Responsive --- */
@media (max-width: 820px) {
  .detail-panel { width: 100%; }
  .batch-bar { bottom: 70px; }
}

/* --- Photo Timeline --- */
.photo-timeline { display: grid; gap: 20px; }
.photo-month-section { display: grid; gap: 12px; }
.photo-month-header { display: flex; align-items: baseline; gap: 10px; padding: 0 2px; }
.photo-month-header h3 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.photo-month-count { font-size: 13px; color: var(--cd-muted); font-weight: 500; }
.photo-day-section { display: grid; gap: 8px; }
.photo-day-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--cd-radius-sm); background: var(--cd-surface); border: 1px solid var(--cd-line); cursor: pointer; transition: background .15s; user-select: none; }
.photo-day-header:hover { background: var(--cd-surface-elevated); }
.photo-day-label { flex: 1; font-size: 14px; font-weight: 600; }
.photo-day-count { font-size: 12px; color: var(--cd-muted); }
.photo-day-toggle { display: grid; place-items: center; width: 20px; height: 20px; transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.photo-day-toggle .icon { width: 16px; height: 16px; }
.photo-day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; transition: max-height .3s ease, opacity .2s ease; overflow: hidden; }
.photo-day-grid.collapsed { max-height: 0; opacity: 0; gap: 0; }
.photo-thumb-card { position: relative; border-radius: var(--cd-radius-sm); overflow: hidden; background: var(--cd-surface); border: 1px solid var(--cd-line); cursor: pointer; transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s, border-color .18s; }
.photo-thumb-card:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 24px rgba(0,0,0,.15); border-color: var(--cd-blue); }
.photo-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-thumb-placeholder { width: 100%; aspect-ratio: 1; display: grid; place-items: center; background: var(--cd-file-thumb-bg); color: var(--cd-muted); }
.photo-thumb-placeholder .icon { width: 28px; height: 28px; }
.photo-thumb-name { padding: 4px 6px; font-size: 11px; color: var(--cd-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 820px) {
  .photo-day-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
  .photo-month-header h3 { font-size: 17px; }
}
@media (max-width: 560px) {
  .photo-day-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- Camera Viewfinder (即拍即传) --- */
.camera-overlay { position: fixed; inset: 0; z-index: 200; background: #000; display: flex; flex-direction: column; }
.camera-viewfinder { flex: 1; object-fit: cover; width: 100%; min-height: 0; background: #000; }
.camera-snapshot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1; }
.camera-top-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: max(env(safe-area-inset-top, 12px), 12px) 16px 12px; background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, transparent 100%); }
.camera-status { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.85); text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.camera-btn { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.15); border: none; color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background .15s, transform .12s; }
.camera-btn:hover { background: rgba(255,255,255,.25); }
.camera-btn:active { transform: scale(.92); }
.camera-btn .icon { width: 22px; height: 22px; stroke: #fff; }
.camera-bottom-bar { position: absolute; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-around; padding: 20px 24px max(env(safe-area-inset-bottom, 16px), 20px); background: linear-gradient(0deg, rgba(0,0,0,.6) 0%, transparent 100%); }
.camera-shutter-btn { width: 72px; height: 72px; border-radius: 50%; background: #fff; border: 4px solid rgba(255,255,255,.4); cursor: pointer; position: relative; transition: transform .1s; box-shadow: 0 0 0 3px rgba(255,255,255,.1), 0 4px 20px rgba(0,0,0,.3); }
.camera-shutter-btn::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #fff; transition: background .1s; }
.camera-shutter-btn:active { transform: scale(.9); }
.camera-shutter-btn:active::after { background: #e0e0e0; }
.camera-shutter-btn.capturing { animation: shutterFlash .2s ease-out; }
@keyframes shutterFlash { 0% { transform: scale(.85); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
.camera-gallery-btn { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; padding: 0; }
.camera-gallery-thumb { width: 100%; height: 100%; background: rgba(255,255,255,.1); display: grid; place-items: center; font-size: 10px; color: rgba(255,255,255,.5); }
.camera-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.camera-switch-btn .icon { transform: rotate(90deg); }

/* --- FAB Menu --- */
.fab-menu { position: fixed; bottom: 80px; right: 20px; z-index: 95; display: grid; gap: 8px; animation: fabMenuIn .2s cubic-bezier(.34,1.56,.64,1); }
@keyframes fabMenuIn { from { opacity: 0; transform: translateY(12px) scale(.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
.fab-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; background: var(--cd-glass-strong); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--cd-line); color: var(--cd-text); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .12s; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.fab-item:hover { background: var(--cd-surface-elevated); transform: translateX(-4px); }
.fab-item:active { transform: scale(.96); }
.fab-item-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--cd-blue-soft); color: var(--cd-blue); }
.fab-item-icon .icon { width: 16px; height: 16px; }
@media (max-width: 820px) { .fab-menu { bottom: 72px; right: 14px; } }
.camera-gallery-strip { position: absolute; bottom: 120px; left: 16px; right: 16px; z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 4px; scrollbar-width: none; }
.camera-gallery-strip::-webkit-scrollbar { display: none; }
.camera-gallery-strip .cam-strip-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; flex-shrink: 0; border: 2px solid rgba(255,255,255,.3); cursor: pointer; transition: border-color .15s, transform .15s; }
.camera-gallery-strip .cam-strip-thumb:hover { border-color: #fff; transform: scale(1.05); }
.camera-gallery-strip .cam-strip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.camera-gallery-strip .cam-strip-thumb.uploading { border-color: var(--cd-blue, #4a9eff); }
.camera-gallery-strip .cam-strip-thumb.uploaded { border-color: #34c759; }
.camera-upload-indicator { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 15; display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; background: rgba(0,0,0,.65); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: #fff; font-size: 12px; font-weight: 600; }
.camera-upload-progress { width: 100px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); overflow: hidden; }
.camera-upload-bar { height: 100%; background: #4a9eff; border-radius: 2px; transition: width .2s; width: 0; }
.camera-flash-effect { position: fixed; inset: 0; z-index: 300; background: #fff; opacity: 0; pointer-events: none; animation: cameraFlash .15s ease-out; }
@keyframes cameraFlash { 0% { opacity: .7; } 100% { opacity: 0; } }
@media (min-width: 821px) {
  .camera-overlay { background: #111; }
  .camera-viewfinder { max-width: 100%; max-height: 100%; object-fit: contain; }
  .camera-bottom-bar { justify-content: center; gap: 48px; }
}
