* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Arial, sans-serif;
  background: #14151a;
  color: #e8e8ea;
}
#toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1c1e24;
  border-bottom: 1px solid #2a2c33;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
#toolbar h1 { font-size: 18px; margin: 0 12px 0 0; }
#toolbar input, #toolbar select, #toolbar button {
  background: #26282f;
  color: #e8e8ea;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
#toolbar button { cursor: pointer; }
#toolbar button:hover { background: #33363f; }
.spacer { flex: 1; }
#importPath { width: 220px; }
#status { color: #9aa0ac; font-size: 12px; }

#loginWrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#loginBox {
  background: #1c1e24;
  border: 1px solid #2a2c33;
  border-radius: 10px;
  padding: 32px;
  width: min(320px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#loginBox h1 { font-size: 18px; margin: 0 0 8px; text-align: center; }
#loginBox input {
  background: #26282f;
  color: #e8e8ea;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}
#loginBox button {
  background: #2a3f5f;
  color: #9cc4ff;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 6px;
}
#loginBox button:hover { background: #33465f; }
#loginError {
  background: #5f2a2a;
  color: #ffb0b0;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}
#loginError.hidden { display: none; }

.role-badge {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 10px;
  background: #26282f;
  color: #9aa0ac;
  border: 1px solid #3a3d46;
}
.role-badge.admin { background: #2a3f5f; color: #9cc4ff; }
.admin-only.hidden-for-viewer { display: none !important; }

.view-toggle { display: flex; border: 1px solid #3a3d46; border-radius: 6px; overflow: hidden; }
.view-toggle button {
  border: none;
  border-radius: 0;
  background: #26282f;
  color: #b8bcc6;
}
.view-toggle button.active { background: #2a3f5f; color: #9cc4ff; }
.view-toggle button:hover { background: #33363f; }

.trash-btn.active { background: #5f2a2a; color: #ff9c9c; border-color: #8a3f3f; }
.delist-btn { background: #3a1f1f !important; color: #ff9c9c !important; }
.delist-btn:hover { background: #4a2626 !important; }
.delist-btn.restore { background: #1f3a26 !important; color: #9cffb0 !important; }
.delist-btn.restore:hover { background: #264a30 !important; }

#columnsPicker {
  right: 0;
  left: auto;
  min-width: 200px;
  padding: 6px;
}
#columnsPicker label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
}
#columnsPicker label:hover { background: #33363f; }

#tableWrap { padding: 16px; overflow-x: auto; }
#tableWrap.hidden { display: none; }
#clipsTable { width: 100%; border-collapse: collapse; font-size: 13px; }
#clipsTable th {
  text-align: left;
  padding: 8px 12px;
  color: #9aa0ac;
  font-weight: 500;
  border-bottom: 1px solid #2a2c33;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
#clipsTable th:hover { color: #e8e8ea; }
#clipsTable th.sorted::after { content: " \25BE"; }
#clipsTable th.sorted.asc::after { content: " \25B4"; }
#clipsTable td {
  padding: 8px 12px;
  border-bottom: 1px solid #1e2027;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
#clipsTable tbody tr { cursor: pointer; }
#clipsTable tbody tr:hover { background: #1c1e24; }
#clipsTable td.filename-cell { max-width: 380px; }

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding: 16px;
}
.card {
  background: #1c1e24;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid #2a2c33;
  transition: transform 0.1s;
}
.card:hover { transform: scale(1.02); border-color: #4a90e2; }
.card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #0d0e11;
  display: block;
}
.card .meta { padding: 8px; }
.card .filename {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card .date { font-size: 11px; color: #9aa0ac; margin-top: 2px; }
.card .chips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 10px;
  background: #2a3f5f;
  color: #9cc4ff;
  padding: 2px 6px;
  border-radius: 10px;
}
.chip.edited { background: #5f3f2a; color: #ffb98a; }
.chip.category { background: #4a2a5f; color: #d29cff; }

#pager {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  align-items: center;
}
#pager button {
  background: #26282f;
  color: #e8e8ea;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
}

#playerOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#playerOverlay.hidden { display: none; }
#playerBox {
  background: #1c1e24;
  border-radius: 10px;
  padding: 16px;
  width: min(900px, 92vw);
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
}
#closePlayer {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: #e8e8ea;
  font-size: 24px;
  cursor: pointer;
}
#videoEl { width: 100%; max-height: 60vh; background: #000; border-radius: 6px; }
#playerControls .row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
#playerControls input {
  flex: 1;
  background: #26282f;
  color: #e8e8ea;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 8px 10px;
}
#playerControls button {
  background: #2a3f5f;
  color: #9cc4ff;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}
#tagChips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#tagChips .chip { font-size: 12px; padding: 4px 8px; display: flex; align-items: center; gap: 6px; }
#tagChips .chip button { background: none; border: none; color: #ffb0b0; cursor: pointer; font-size: 13px; padding: 0; }
.nav { justify-content: space-between; margin-top: 16px; }
#clipMeta { font-size: 12px; color: #9aa0ac; }

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a808f;
  margin-top: 16px;
  margin-bottom: 6px;
}

#categoryPills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  background: #26282f;
  color: #b8bcc6;
  border: 1px solid #3a3d46;
  border-radius: 14px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.pill:hover { background: #33363f; }
.pill.active { background: #4a2a5f; color: #d29cff; border-color: #6a3f8a; }

#peopleChips { display: flex; flex-wrap: wrap; gap: 6px; }
.person-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #26282f;
  color: #b8bcc6;
  border: 1px solid #3a3d46;
  border-radius: 14px;
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  cursor: pointer;
}
.person-toggle:hover { background: #33363f; }
.person-toggle.checked { background: #1f4a30; color: #9cffb0; border-color: #2f6a45; }
.person-toggle .box {
  width: 13px;
  height: 13px;
  border: 1px solid #6a6f7a;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
.person-toggle.checked .box { border-color: #9cffb0; background: #2f6a45; }
.empty-hint { font-size: 12px; color: #7a808f; }

.autocomplete-wrap { position: relative; }
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #22242b;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 20;
}
.suggestions.hidden { display: none; }
.suggestions .item {
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}
.suggestions .item:hover, .suggestions .item.active { background: #33363f; }
.suggestions .item .count { color: #7a808f; }

#transcriptInput {
  width: 100%;
  min-height: 80px;
  background: #26282f;
  color: #e8e8ea;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
#transcriptStatus { font-size: 12px; color: #7a808f; }

#peopleOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
}
#peopleOverlay.hidden { display: none; }
#peopleBox {
  background: #1c1e24;
  border-radius: 10px;
  padding: 20px;
  width: min(420px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
#peopleBox h2 { margin: 0 0 12px; font-size: 16px; }
#closePeople {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: #e8e8ea;
  font-size: 24px;
  cursor: pointer;
}
#peopleBox .row { display: flex; gap: 8px; margin-bottom: 14px; }
#peopleBox input {
  flex: 1;
  background: #26282f;
  color: #e8e8ea;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 8px 10px;
}
#peopleBox button {
  background: #2a3f5f;
  color: #9cc4ff;
  border: 1px solid #3a3d46;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}
#rosterList { display: flex; flex-direction: column; gap: 6px; }
.roster-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #22242b;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}
.roster-row .count { color: #7a808f; font-size: 11px; margin-left: 8px; }
.roster-row button {
  background: none;
  border: none;
  color: #ffb0b0;
  cursor: pointer;
  font-size: 15px;
  padding: 0;
}
