:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d9e0ea;
  --text: #182230;
  --muted: #667085;
  --accent: #1f6fb2;
  --accent-strong: #13558d;
  --ink: #111827;
  --ok: #067647;
  --warn: #b54708;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body:not(.has-auth) .auth-gated {
  display: none !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 28px;
  background: #101828;
  color: #fff;
}

.topbar h1,
.panel h2,
.panel h3,
.eyebrow,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 24px;
  letter-spacing: 0;
}

.eyebrow {
  color: #b8c7dc;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #344054;
  border-radius: 6px;
  color: #e4e9f2;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.nav-link.active {
  border-color: #9cc7ec;
  color: #fff;
  background: #1d2939;
}

.shell {
  width: min(1320px, calc(100% - 32px));
  margin: 20px auto 42px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-shell {
  grid-template-columns: 360px minmax(0, 1fr);
}

.docs-shell {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
}

.content {
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.panel h3 {
  margin-bottom: 12px;
  font-size: 15px;
  letter-spacing: 0;
}

.small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

label {
  display: block;
  margin: 12px 0 5px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea,
button {
  width: 100%;
  font: inherit;
}

input,
select,
textarea {
  min-height: 38px;
  border: 1px solid #c8d1de;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 118px;
  resize: vertical;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #475467;
}

button.secondary.ready {
  background: var(--accent);
}

button.ghost {
  border: 1px solid #c8d1de;
  background: #fff;
  color: #344054;
}

button.ghost:hover {
  background: #f2f4f7;
}

button.danger {
  background: var(--bad);
}

button.danger:hover {
  background: #8f1d15;
}

button:disabled,
button:disabled:hover {
  background: #98a2b3;
  cursor: not-allowed;
}

button.compact {
  width: auto;
  min-width: 120px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  margin-top: 12px;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.secondary-link {
  border: 1px solid #c8d1de;
  background: #fff;
  color: #344054;
}

.secondary-link:hover {
  background: #f2f4f7;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.entry-shell {
  width: min(520px, calc(100% - 32px));
  margin: 28px auto 42px;
}

.wide-entry {
  width: min(920px, calc(100% - 32px));
}

.entry-card form + button,
.entry-card form + .button-link {
  margin-top: 14px;
}

.entry-card form > button[type="submit"] {
  margin-top: 18px;
}

#uploadForm > button[type="submit"] {
  margin-top: 18px;
}

.tabs,
.filters,
.three-col,
.file-grid,
.two-col,
.preview-layout {
  display: grid;
  gap: 14px;
}

.tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col,
.file-grid,
.filters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-col .file-grid {
  grid-template-columns: 1fr;
}

.preview-layout {
  grid-template-columns: minmax(280px, .85fr) minmax(0, 1fr);
  margin-top: 16px;
}

.mini-card {
  display: grid;
  gap: 4px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.mini-card.stacked {
  margin-top: 18px;
}

.metric {
  font-size: 26px;
  font-weight: 800;
}

.status {
  min-height: 44px;
  margin-top: 14px;
  padding: 10px;
  border-radius: 6px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status.ok {
  background: #ecfdf3;
  color: var(--ok);
}

.status.bad {
  background: #fef3f2;
  color: var(--bad);
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.thumb {
  width: 96px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.video-thumb {
  width: 140px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.badge.approved,
.badge.ACTIVE {
  background: #dcfae6;
  color: var(--ok);
}

.badge.pending_review,
.badge.APPROVAL_PENDING {
  background: #fef0c7;
  color: var(--warn);
}

.badge.rejected {
  background: #fee4e2;
  color: var(--bad);
}

.badge.paused {
  background: #e4e7ec;
  color: #475467;
}

.preview-box {
  min-height: 160px;
  border: 1px dashed #aeb7c6;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
  overflow: auto;
}

.embed-code {
  min-height: 118px;
  margin: 0;
  padding: 12px;
  border-radius: 6px;
  background: #101828;
  color: #d0d5dd;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  overflow-x: auto;
  white-space: pre;
}

.admin-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

#networkAdForm {
  display: grid;
  gap: 14px;
}

.review-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 220px;
  gap: 16px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.review-media {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.review-media img,
.review-media video {
  max-width: 100%;
  max-height: 180px;
}

.review-title {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.review-actions {
  display: grid;
  gap: 10px;
}

.review-actions button {
  margin: 0;
}

.empty {
  padding: 18px;
  border: 1px dashed #aeb7c6;
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
}

.notice {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.notice strong {
  display: block;
  margin-bottom: 8px;
}

.notice ol {
  margin: 0;
  padding-left: 20px;
}

.notice li {
  margin: 5px 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .topbar,
  .shell,
  .admin-shell,
  .two-col,
  .three-col,
  .file-grid,
  .filters,
  .preview-layout,
  .review-card {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .shell,
  .admin-shell {
    width: min(100% - 24px, 760px);
  }

  .sidebar {
    position: static;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
