:root {
  --bg: #0e1420;
  --panel: #141b2b;
  --panel-2: #1b2436;
  --border: #263149;
  --text: #e6ebf5;
  --muted: #8a94a8;
  --accent: #3b82f6;
  --danger: #ef4444;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

input, button {
  font: inherit;
  color: inherit;
}

input[type="text"], input[type="password"], input[type="date"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
}

button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}

button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); }

/* Login */
.login-view {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h1 { font-size: 18px; margin: 0 0 8px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-size: 13px; min-height: 16px; }

/* App shell */
.app-view { display: flex; height: 100vh; }

.sidebar {
  width: 200px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 6px;
}

.brand { font-weight: 700; letter-spacing: 1px; margin-bottom: 16px; color: var(--accent); }

.nav-item {
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 6px;
}

.nav-item.active, .nav-item:hover { background: var(--panel-2); }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.content { flex: 1; padding: 20px 28px; overflow-y: auto; }

.view h2 { margin-top: 0; }

.filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

.search-body { display: flex; gap: 20px; }

.results-panel { flex: 2; min-width: 0; }
.detail-panel { flex: 1; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; min-width: 280px; }

.results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.results-table th, .results-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.results-table tr:hover { background: var(--panel-2); cursor: pointer; }

.placeholder { color: var(--muted); }
.muted { color: var(--muted); }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn { background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 6px 4px; }
.tab-btn.active { border-bottom-color: var(--accent); color: var(--accent); }

.detail-field { font-size: 13px; margin-bottom: 6px; }
.detail-field .label { color: var(--muted); margin-right: 6px; }

.file-row { font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }

video { width: 100%; border-radius: 6px; margin-bottom: 12px; background: #000; }

.selected-tray {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.selected-summary { font-weight: 600; margin-bottom: 8px; }
.selected-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.selected-chip { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 4px 10px; font-size: 12px; }
.selected-actions { display: flex; gap: 10px; }

.inline-form { display: flex; gap: 10px; margin-bottom: 16px; }

#collection-detail { margin-top: 16px; font-size: 13px; }

/* Sidebar status panels */
.sidebar-panel { margin-top: 18px; font-size: 12px; }
.sidebar-panel-title { font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 8px; }
.status-list { display: flex; flex-direction: column; gap: 4px; }
.status-row { display: flex; justify-content: space-between; gap: 8px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.available, .status-dot.online { background: #22c55e; }
.status-dot.preview_available { background: var(--accent); }
.status-dot.retrieving { background: #f59e0b; }
.status-dot.offline_required, .status-dot.offline { background: var(--danger); }
.status-dot.not_in_orain, .status-dot.unknown, .status-dot.not_configured { background: var(--muted); }

/* Results table additions */
.thumb-placeholder {
  width: 56px;
  height: 32px;
  border-radius: 4px;
  background: linear-gradient(135deg, #263149, #1b2436);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge.available { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.status-badge.preview_available { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.status-badge.retrieving { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.status-badge.offline_required { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.status-badge.not_in_orain, .status-badge.unknown { background: rgba(138, 148, 168, 0.15); color: var(--muted); }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
}
.rows-per-page { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.rows-per-page select { padding: 4px 6px; }
#prev-page-btn, #next-page-btn { padding: 4px 10px; }
