* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --line: #d9dee7;
  --line-soft: #edf0f4;
  --text: #1f2937;
  --muted: #667085;
  --accent: #2457c5;
  --danger: #b42318;
  --sidebar: #182230;
}

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

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

button.ghost {
  background: white;
  color: var(--text);
  border-color: var(--line);
}

button.danger {
  color: var(--danger);
}

input,
select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 7px 10px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  background: var(--sidebar);
  color: white;
  padding: 22px 18px;
}

.brand {
  display: grid;
  gap: 4px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand strong {
  font-size: 17px;
}

.brand span,
.socket {
  color: #aab3c2;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}

nav a {
  color: #d8dee9;
  text-decoration: none;
  padding: 10px 8px;
  border-radius: 6px;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.socket {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.main {
  margin-left: 236px;
  padding: 28px;
}

.pageHeader,
.sectionHeader,
.actions,
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pageHeader {
  margin-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 700;
}

h2 {
  font-size: 16px;
  font-weight: 700;
}

p,
.sectionHeader p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}

.keywordForm,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.keywordForm input[name="keyword"],
.filters input {
  min-width: 220px;
}

.keywordForm label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.tableWrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

tr.isSelected td {
  background: #eef4ff;
}

.statusPill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
}

.statusPill.completed { background: #ecfdf3; color: #067647; }
.statusPill.running { background: #eff8ff; color: #175cd3; }
.statusPill.failed { background: #fef3f2; color: #b42318; }
.statusPill.cancelled { background: #f2f4f7; color: #667085; }
.statusPill.queued { background: #fffaeb; color: #b54708; }

.pager {
  justify-content: flex-end;
  margin-top: 12px;
  color: var(--muted);
}

.previewColumns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.subHeader {
  color: #475467;
  font-weight: 700;
  margin-bottom: 10px;
}

.assetGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  min-height: 120px;
}

.assetCard {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.assetCard img,
.assetCard video {
  display: block;
  width: 100%;
  background: #111827;
}

.assetMediaButton {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #111827;
  cursor: zoom-in;
}

.assetCard img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.assetCard video {
  aspect-ratio: 9 / 16;
  object-fit: cover;
}

.assetMeta {
  display: grid;
  gap: 3px;
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}

.assetMeta strong {
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fbfcfd;
}

.imageModal {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: white;
  color: var(--text);
}

.imageModal::backdrop {
  background: rgba(15, 23, 42, 0.72);
}

.imageModalShell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 32px);
}

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

.imageModalHeader div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.imageModalHeader strong,
.imageModalHeader span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.imageModalHeader span {
  color: var(--muted);
  font-size: 12px;
}

.imageModalBody {
  display: grid;
  place-items: center;
  min-height: 260px;
  overflow: auto;
  background: #111827;
}

.imageModalBody img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 112px);
  object-fit: contain;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .socket {
    position: static;
    margin-top: 16px;
  }

  .main {
    margin-left: 0;
    padding: 18px;
  }

  .pageHeader,
  .sectionHeader,
  .previewColumns {
    display: grid;
    grid-template-columns: 1fr;
  }
}
