:root {
  --bg: #080809;
  --panel: #141416;
  --panel-2: #1b1b1f;
  --line: #303036;
  --muted: #a7a7ad;
  --text: #f8f8fa;
  --red: #e00000;
  --red-2: #ff3030;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  background: #18181c;
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  border-color: var(--red);
}

button.primary,
.action-button.active {
  background: var(--red);
  border-color: var(--red);
}

button.danger {
  background: #260909;
  border-color: #7c1717;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  color: #fff;
  background: #0e0e11;
  border: 1px solid #34343a;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.tagger-shell {
  display: grid;
  gap: 16px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.panel,
.last-save {
  border: 1px solid var(--line);
  background: var(--panel);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand img {
  width: 230px;
  height: 46px;
  object-fit: contain;
  object-position: left center;
}

.brand span,
.panel-head span,
.hint,
.last-save {
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.import-catalog {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  background: #18181c;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  text-transform: none;
}

.import-catalog:hover {
  border-color: var(--red);
}

.import-catalog input {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr) minmax(270px, 360px);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.events-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.events-tools label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.events-tools select {
  width: auto;
  min-width: 150px;
  min-height: 32px;
}

.context-panel,
.actions-panel {
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
}

.context-panel > label,
.context-panel > button,
.context-panel > .grid-2,
.context-panel > .context-readout,
.context-panel > .hint {
  margin-inline: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  text-transform: none;
}

.context-readout {
  display: grid;
  gap: 4px;
  padding: 10px;
  color: #fff;
  background: #0d0d10;
  border: 1px solid #2d2d34;
  font-size: 13px;
}

.context-readout strong {
  font-size: 15px;
}

.context-readout span {
  color: var(--muted);
}

.video-stage {
  display: grid;
  place-items: center;
  min-height: 460px;
  background: #030303;
}

.video-stage p {
  max-width: 360px;
  color: var(--muted);
  text-align: center;
}

.video-stage iframe,
.video-stage video {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 460px;
  border: 0;
  background: #000;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.player-controls strong {
  margin-left: auto;
  font-size: 18px;
}

.action-buttons {
  display: grid;
  gap: 8px;
  padding: 14px;
  max-height: 650px;
  overflow: auto;
}

.clip-builder {
  display: grid;
  gap: 8px;
  margin: 14px 14px 0;
  padding: 12px;
  background: #0d0d10;
  border: 1px solid #29292f;
}

.clip-builder span,
.clip-builder small {
  color: var(--muted);
}

.clip-builder strong {
  font-size: 22px;
}

.builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.featured-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  color: #fff;
  background: #111116;
  border: 1px solid #34343c;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.action-group {
  display: grid;
  gap: 7px;
  padding: 8px;
  background: #0d0d10;
  border: 1px solid #29292f;
}

.action-group h3 {
  margin: 0;
  color: #fff;
  font-size: 12px;
  text-transform: uppercase;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.action-button {
  min-height: 42px;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  text-align: left;
}

.action-button kbd {
  display: grid;
  place-items: center;
  height: 24px;
  color: #fff;
  background: #050506;
  border: 1px solid #44444a;
  font-size: 11px;
  font-weight: 900;
}

.action-button span {
  font-size: 12px;
  line-height: 1.15;
}

.action-button em {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  color: #fff;
  background: #050506;
  border: 1px solid rgba(255, 255, 255, 0.42);
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.last-save {
  margin: 0 14px;
  padding: 12px;
  font-size: 13px;
}

.events-panel {
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

table {
  width: 100%;
  min-width: 1140px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #2b2b31;
  text-align: left;
  font-size: 13px;
}

th {
  color: #fff;
  background: #09090b;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  color: #dedee4;
}

.youtube-title-cell {
  max-width: 260px;
  color: #f3f3f5;
  font-weight: 700;
}

.youtube-title-cell .yt-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.youtube-title-cell .pending {
  color: var(--muted);
  font-weight: 700;
}

.tiny {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.tiny.featured-on {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  padding: 12px 16px;
  color: #fff;
  background: #111;
  border: 1px solid var(--red);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.36);
  font-weight: 900;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .brand img {
    width: 180px;
  }
}
