:root {
  /* Core Colors */
  --bg-app: #131316;        /* Near-black */
  --bg-sidebar: #1a1a1f;    /* Slight lift */
  --bg-panel: #1a1a1f;
  --bg-input: #242429;      /* Input surfaces */
  --bg-surface: #1e1e23;    /* Cards, elevated */
  
  /* Text */
  --text-primary: #e8e8ed;
  --text-secondary: #8e8e9a;
  --text-muted: #5a5a66;
  
  /* Borders */
  --border-subtle: #2a2a30;
  --border-active: #3a3a42;
  --border-hover: #44444e;
  
  /* Accent - Cool violet (used as outline/accent ONLY, never solid fill) */
  --accent-primary: #7c6ef0;
  --accent-dim: rgba(124, 110, 240, 0.12);
  --accent-border: rgba(124, 110, 240, 0.35);
  --accent-hover: #6a5ee0;
  --accent-text: #ffffff;
  
  /* Semantic */
  --danger: #e55b5b;
  --danger-dim: rgba(229, 91, 91, 0.1);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 20px;
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  /* Transition */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }

body, html {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-container {
  display: flex; /* Robust layout */
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  height: 54px;
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--accent-dim);
  color: var(--accent-primary);
  border-color: var(--accent-border);
}

.btn-icon i,
.btn-icon .ph {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.session-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Project Item - Clean flat style */
.session-item {
  padding: 10px 12px;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s var(--ease);
}

.session-item:hover {
  background-color: var(--bg-input);
  color: var(--text-primary);
}

.session-item.active {
  background-color: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px rgba(124, 110, 240, 0.18);
}

/* Main Workspace */
.main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevent flex blowout */
  background-color: var(--bg-app);
}

/* Header */
.workspace-header {
  height: 54px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background-color: var(--bg-app);
}

.workspace-header h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.workspace-header .meta {
  font-size: 11px;
  color: var(--text-muted);
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-picker {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}

.model-picker .model-icon {
  width: 14px;
  height: 14px;
  color: transparent;
  stroke: var(--accent-primary);
  fill: none;
  stroke-width: 1.6;
  position: absolute;
  left: 10px;
  pointer-events: none;
}

.model-picker label {
  display: none; /* Hide the label, the select is self-descriptive */
}

.model-picker select {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 28px 5px 28px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238e8e9a' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}

.model-picker select:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.model-picker select:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* View Toggle - Sleek segmented control */
.view-toggle-slider {
  display: flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  background-color: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
}

.toggle-option:hover:not(.active) {
  color: var(--text-secondary);
}

.toggle-option.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-option i,
.toggle-option .ph {
  width: 14px;
  height: 14px;
  font-size: 14px;
}

.toggle-option span {
  font-weight: 500;
}

.btn-account {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-account:hover {
  border-color: var(--accent-border);
  color: var(--accent-primary);
  background-color: var(--accent-dim);
}

.btn-account i,
.btn-account .ph {
  width: 16px;
  height: 16px;
  font-size: 16px;
}

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Chat */
.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* View Mode */
.view-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: #000;
}

.view-pane .composer {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  background: transparent;
  border-top: none;
}

.view-content {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.view-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  width: 100%;
  height: 100%;
}

.view-placeholder i,
.view-placeholder .ph {
  font-size: 48px;
  opacity: 0.4;
}

.view-placeholder p {
  font-size: 13px;
  margin: 0;
}

.view-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.view-video-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view-media-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.timeline-tooltip {
  position: absolute;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 5;
}

.video-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 12px;
  background: rgba(0, 0, 0, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.controls-left,
.controls-center,
.controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.controls-left {
  min-width: 160px;
}

.controls-center {
  flex: 1;
}

.controls-right {
  min-width: 90px;
  justify-content: flex-end;
}

.control-btn {
  background: transparent;
  border: none;
  color: #e5e7eb;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
}

.control-btn.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.control-btn.disabled:hover {
  background: transparent;
}

.control-btn i,
.control-btn .ph {
  width: 16px;
  height: 16px;
  font-size: 16px;
}

.time-label {
  font-variant-numeric: tabular-nums;
  color: #e5e7eb;
  font-size: 12px;
}

.timeline-wrap {
  position: relative;
  width: 100%;
}

.timeline-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
  transform: translateX(-50%);
}

.timeline-range {
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffffff var(--progress, 0%), rgba(255, 255, 255, 0.25) var(--progress, 0%));
  cursor: pointer;
}

.timeline-range::-webkit-slider-thumb {
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.timeline-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.volume-range {
  appearance: none;
  width: 70px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.volume-range::-webkit-slider-thumb {
  appearance: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.volume-range::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.volume-range.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.view-media.image {
  cursor: zoom-in;
}

.view-media.video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.message {
  max-width: 68%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 1em;
  line-height: 1.55;
  word-wrap: break-word;
  border: 1px solid transparent;
}

.message.user {
  align-self: flex-end;
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: rgba(124, 110, 240, 0.55);
  border-width: 1.5px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.message.ai {
  align-self: flex-start;
  background: transparent;
  color: var(--text-primary);
  border-color: transparent;
  border-bottom-left-radius: 4px;
  box-shadow: none;
  position: relative;
  padding-left: 0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.message.ai .ai-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  color: var(--accent-primary);
  vertical-align: middle;
  flex-shrink: 0;
  margin-top: 2px;
}

.message.ai .ai-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.message.ai .ai-content {
  flex: 1;
  min-width: 0;
  text-align: left;
  word-spacing: normal;
  letter-spacing: normal;
  text-justify: auto;
  white-space: normal;
}

/* Markdown styling for AI messages */
.message.ai .ai-content.markdown-body {
  background-color: transparent;
  color: var(--text-primary);
  font-size: 1em;
  line-height: 1.55;
  border-color: transparent;
  box-shadow: none;
}

.message.ai .ai-content.markdown-body h1,
.message.ai .ai-content.markdown-body h2,
.message.ai .ai-content.markdown-body h3,
.message.ai .ai-content.markdown-body h4,
.message.ai .ai-content.markdown-body h5,
.message.ai .ai-content.markdown-body h6,
.message.ai h1,
.message.ai h2,
.message.ai h3,
.message.ai h4,
.message.ai h5,
.message.ai h6 {
  color: #c7b9ff;
  border-bottom: none;
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-shadow: 0 0 12px rgba(124, 110, 240, 0.35);
}

.message.ai .ai-content.markdown-body h1,
.message.ai h1 { font-size: 1.6em; color: #e1c6ff; }
.message.ai .ai-content.markdown-body h2,
.message.ai h2 { font-size: 1.35em; color: #a8c7ff; border-bottom: 1px solid rgba(124, 110, 240, 0.3); padding-bottom: 4px; }
.message.ai .ai-content.markdown-body h3,
.message.ai h3 { font-size: 1.2em; color: #f1a7c8; }

.message.ai .ai-content.markdown-body p,
.message.ai p {
  margin-top: 0;
  margin-bottom: 14px;
  color: #e3e3ee;
}

.message.ai .ai-content.markdown-body code,
.message.ai code {
  background: linear-gradient(135deg, rgba(124, 110, 240, 0.18), rgba(244, 114, 182, 0.12));
  color: #f1d6ff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.message.ai .ai-content.markdown-body pre,
.message.ai pre {
  background: linear-gradient(135deg, rgba(24, 20, 36, 0.95), rgba(28, 24, 42, 0.95));
  border: 1px solid rgba(124, 110, 240, 0.35);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  margin: 14px 0;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

.message.ai.markdown-body pre code {
  background-color: transparent;
  color: #f8f8f2;
  padding: 0;
  font-size: 0.9em;
}

.message.ai.markdown-body ul,
.message.ai.markdown-body ol {
  margin: 8px 0;
  padding-left: 24px;
}

.message.ai.markdown-body li {
  margin: 4px 0;
}

.message.ai .ai-content.markdown-body blockquote,
.message.ai blockquote {
  border-left: 3px solid rgba(244, 114, 182, 0.6);
  padding-left: 12px;
  margin: 12px 0;
  color: #c9c2d8;
  font-style: italic;
  background: linear-gradient(90deg, rgba(124, 110, 240, 0.12), rgba(244, 114, 182, 0.08));
  border-radius: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.message.ai .ai-content.markdown-body a,
.message.ai a {
  color: #b5b1ff;
  text-decoration: none;
}

.message.ai .ai-content.markdown-body ul,
.message.ai .ai-content.markdown-body ol,
.message.ai ul,
.message.ai ol {
  padding-left: 24px;
}

.message.ai .ai-content.markdown-body li,
.message.ai li {
  margin: 6px 0;
}

.message.ai .ai-content.markdown-body li::marker,
.message.ai li::marker {
  color: #a78bfa;
}

.message.ai.markdown-body a:hover {
  text-decoration: underline;
}

.message.ai.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}

.message.ai.markdown-body table th,
.message.ai.markdown-body table td {
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  text-align: left;
}

.message.ai.markdown-body table th {
  background-color: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

.message.ai.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 16px 0;
}

.message.ai.markdown-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.message.ai.markdown-body em {
  font-style: italic;
  color: var(--text-secondary);
}

.composer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-app);
}

.input-group {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: border-color 0.15s var(--ease);
}

.input-group:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px rgba(124, 110, 240, 0.15);
}

textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  resize: none;
  font-family: inherit;
  font-size: 13.5px;
  padding: 4px 0;
  outline: none;
  min-height: 22px;
  max-height: 160px;
  line-height: 1.5;
}

textarea::placeholder {
  color: var(--text-muted);
}

.btn-send {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  flex-shrink: 0;
  padding: 0;
}

.btn-send:hover {
  color: var(--accent-primary);
  background: var(--accent-dim);
}

.btn-send .ph {
  font-size: 18px;
}

.btn-send svg {
  width: 18px;
  height: 18px;
}

/* Assets Panel (Right) */
.assets-pane {
  width: 290px;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

/* Assets Section (Top 65%) */
.assets-section {
  flex: 6.5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* Output Section (Bottom 35%) */
.output-section {
  flex: 3.5;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.assets-header,
.output-header {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  flex-shrink: 0;
}

.assets-header h3,
.output-header h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.assets-actions {
  display: flex;
  gap: 4px;
}

/* Compact icon buttons for add/delete */
.assets-actions .btn-icon {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.assets-actions .btn-icon:hover {
  background: var(--accent-dim);
  color: var(--accent-primary);
  border-color: transparent;
}

/* Delete button specific - subtle danger styling */
.assets-actions #delete-assets:hover {
  background: var(--danger-dim);
  color: var(--danger);
}

.assets-list {
  flex: 1;
  padding: var(--space-sm);
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  align-content: start;
  position: relative;
  transition: background-color 0.2s var(--ease);
  min-height: 0;
}

.assets-list.drag-over {
  background-color: var(--accent-dim);
  outline: 2px dashed var(--accent-border);
  outline-offset: -6px;
}

.assets-empty {
  grid-column: 1 / -1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
}
/* Output List */
.output-list {
  flex: 1;
  padding: var(--space-sm);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

/* Output Item */
.output-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.output-item:hover {
  background-color: var(--bg-input);
  border-color: var(--border-subtle);
}

.output-item i,
.output-item .ph {
  width: 18px;
  height: 18px;
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.output-item-info {
  flex: 1;
  min-width: 0;
}

.output-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.output-item-size {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Asset Card - Compact */
.asset-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  position: relative;
  aspect-ratio: 1;
}
.asset-card:hover {
  border-color: var(--border-hover);
}

.asset-card.asset-loading {
  opacity: 0.85;
}

.asset-card.asset-loading .asset-preview {
  position: relative;
}

.asset-card.asset-loading .asset-preview::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: spin 1s linear infinite;
}

.asset-card.upload-failed {
  border-color: #ef4444;
}

.asset-card.upload-failed .asset-info {
  color: #fca5a5;
}

.asset-preview {
  flex: 1;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
}

.asset-preview img, .asset-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback icon in preview */
.asset-preview i,
.asset-preview .ph {
  font-size: 28px;
  opacity: 0.4;
}

.asset-info {
  padding: 6px 8px;
  background-color: rgba(255,255,255,0.02);
  border-top: 1px solid var(--border-subtle);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.asset-name {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.asset-path {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.asset-size {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.asset-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block; /* Remove baseline gap */
}

/* Checkbox overlay styling */
.asset-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.25);
  appearance: none;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  display: grid;
  place-content: center;
  z-index: 2;
}

.asset-check:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.asset-check:checked::before {
  content: "";
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Utilities */
.hidden { display: none !important; }

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Responsive */
@media (max-width: 900px) {
  .assets-pane { display: none; } /* Simplify on tablet */
}

@media (max-width: 600px) {
  .sidebar { display: none; } /* Simplify on mobile */
  .workspace-header { padding: 0 var(--space-md); }
}

/* Spinner */
@keyframes spin { 100% { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }
