/* ========== Asset thumbnails ========== */
.asset-thumb {
  position: relative;
  width: 100%;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-2);
  display: block;
}
.asset-thumb.audio {
  background: linear-gradient(135deg, hsl(180 30% 14%), hsl(200 30% 8%));
  display: flex;
  align-items: center;
  justify-content: center;
}
.asset-thumb .thumb-svg { width: 100%; height: 100%; display: block; }
.scanlines {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.06) 2px 3px);
  pointer-events: none;
  opacity: 0.4;
}
.thumb-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.thumb-duration {
  position: absolute;
  right: 6px; bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: white;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.3;
}
.thumb-status {
  position: absolute;
  left: 6px; top: 6px;
  display: flex; gap: 4px;
}

/* ========== Waveform ========== */
.waveform { width: 70%; height: 50%; opacity: 0.85; }
.audio-meter.h { display: flex; gap: 2px; height: 12px; align-items: stretch; }
.audio-meter.v { display: flex; flex-direction: column-reverse; gap: 2px; width: 6px; height: 60px; }
.audio-seg { flex: 1; border-radius: 1px; transition: opacity 80ms, background 80ms; }
.audio-meter.h .audio-seg { min-width: 3px; }
.audio-meter.v .audio-seg { min-height: 2px; }

/* ========== Live strip ========== */
.live-strip {
  display: flex;
  gap: 2px;
  align-items: stretch;
  height: 56px;
  position: relative;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--bg-2);
}
.live-strip-cell {
  flex: 1;
  position: relative;
  overflow: hidden;
  animation: stripIn 600ms ease;
}
.live-strip-cell .thumb-svg { width: 100%; height: 100%; }
@keyframes stripIn {
  from { transform: translateX(20%); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.live-strip-now {
  position: absolute;
  right: 6px; top: 6px;
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--live);
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.live-pulse {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 1.6s ease-in-out infinite;
}

/* ========== Status dot ========== */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.pulse {
  animation: dotpulse 1.6s ease-in-out infinite;
}
@keyframes dotpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ========== Home dashboard ========== */
.home-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  padding: 20px 28px;
}
.home-greeting {
  padding: 24px 28px 0;
}
.home-greeting h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.home-greeting p { margin: 0; color: var(--text-3); font-size: 13px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px 28px;
}
.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.stat-card .label {
  font-size: 11.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.stat-card .value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card .delta {
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card .delta.up { color: var(--success); }
.stat-card .spark {
  position: absolute;
  right: 0; bottom: 0;
  width: 60%; height: 36px;
  opacity: 0.7;
  pointer-events: none;
}

.home-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  padding: 4px 28px 40px;
}
.live-feed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.live-feed-tile {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  cursor: pointer;
  transition: transform 120ms;
  border: 1px solid var(--border);
}
.live-feed-tile:hover { transform: translateY(-1px); border-color: var(--border-stronger); }
.live-feed-tile-label {
  position: absolute;
  left: 8px; bottom: 8px;
  right: 8px;
  display: flex; align-items: center; gap: 6px;
  z-index: 2;
}
.live-feed-tile-label .name {
  color: white;
  font-size: 12px;
  font-weight: 500;
  background: rgba(0,0,0,0.6);
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.live-feed-tile-label .time {
  margin-left: auto;
  color: white;
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(0,0,0,0.6);
  padding: 3px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.live-feed-tile-badge {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
}
.activity-feed {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.activity-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.activity-row:last-child { border-bottom: 0; }
.activity-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: var(--text-2);
}
.activity-icon.comment { background: var(--accent-soft); color: var(--accent-text); }
.activity-icon.record { background: var(--live-soft); color: var(--live); }
.activity-icon.job { background: var(--purple-soft); color: var(--purple); }
.activity-icon.upload { background: var(--bg-3); color: var(--text-2); }
.activity-icon.sync { background: var(--success-soft); color: var(--success); }
.activity-icon.approve { background: var(--success-soft); color: var(--success); }
.activity-icon.error { background: var(--danger-soft); color: var(--danger); }
.activity-text { flex: 1; line-height: 1.4; }
.activity-text strong { color: var(--text-1); font-weight: 500; }
.activity-text .target { color: var(--accent-text); }
.activity-time { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); white-space: nowrap; }

/* ========== Library ========== */
.library-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100%;
  overflow: hidden;
}
.library-rail {
  border-right: 1px solid var(--border);
  background: var(--bg-0);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.library-rail h4 {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-4);
  padding: 0 10px;
}
.rail-list { display: flex; flex-direction: column; gap: 1px; }
.rail-item {
  display: flex; align-items: center; gap: 8px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.rail-item:hover { background: var(--hover); color: var(--text-1); }
.rail-item.active { background: var(--accent-soft); color: var(--accent-text); }
.rail-item.active .rail-icon { color: var(--accent); }
.rail-item .rail-icon { color: var(--text-3); }
.rail-item .rail-count { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.rail-color-dot { width: 8px; height: 8px; border-radius: 50%; }

.library-main {
  display: flex; flex-direction: column;
  overflow: hidden;
}
.library-toolbar {
  padding: 12px 24px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.library-toolbar .toolbar-title {
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em;
}
.library-toolbar .count { color: var(--text-3); font-size: 12.5px; }

.tab-group {
  display: flex;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.tab-group button {
  height: 24px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  border-radius: 4px;
  display: flex; align-items: center; gap: 4px;
}
.tab-group button:hover { color: var(--text-1); }
.tab-group button.active { background: var(--bg-3); color: var(--text-1); }

.library-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-content: start;
}
[data-grid-size="lg"] .library-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
[data-grid-size="sm"] .library-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }

.asset-card {
  position: relative;
  cursor: pointer;
  border-radius: var(--r-md);
  transition: transform 120ms;
}
.asset-card:hover { transform: translateY(-2px); }
.asset-card:hover .asset-thumb { box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-pop); }
.asset-card .meta {
  padding: 8px 4px 4px;
}
.asset-card .meta .name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-card .meta .sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
}
.asset-card.selected .asset-thumb { box-shadow: 0 0 0 2px var(--accent); }

.asset-progress-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
  display: flex;
  align-items: flex-end;
  padding: 8px;
}
.asset-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 99px;
  overflow: hidden;
}
.asset-progress-fill {
  height: 100%;
  background: var(--warning);
  transition: width 200ms;
}

.library-list {
  flex: 1; overflow-y: auto;
  padding: 0 24px 32px;
}
.list-row {
  display: grid;
  grid-template-columns: 80px 2fr 120px 100px 100px 80px 80px 32px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 12.5px;
}
.list-row:hover { background: var(--hover); }
.list-row.head {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  cursor: default;
  position: sticky; top: 0;
  background: var(--bg-0);
  z-index: 1;
  padding-top: 12px;
}
.list-row:hover.head { background: var(--bg-0); }
.list-row .thumb {
  width: 80px; aspect-ratio: 16/9;
  border-radius: 4px; overflow: hidden;
}
.list-row .name { font-weight: 500; }
.list-row .col-sub { color: var(--text-3); font-family: var(--font-mono); font-size: 11.5px; }
