: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;
  overflow-x: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body:not(.has-auth) .auth-gated {
  display: none !important;
}

body:not(.has-staff) .staff-gated {
  display: none !important;
}

body.has-staff .staff-denied {
  display: none !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 28px;
  background: #101828;
  color: #fff;
}

.topbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.menu-toggle {
  display: none;
  width: 44px;
  min-height: 40px;
  padding: 0;
  border: 1px solid #344054;
  background: transparent;
  color: #fff;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px auto;
  border-radius: 999px;
  background: currentColor;
}

.topbar > div:first-child::before {
  content: "";
  display: block;
  width: 150px;
  height: 48px;
  flex: 0 0 150px;
  background: url("./logo.v3.png") center / contain no-repeat;
}

.topbar > div:first-child .eyebrow,
.topbar > div:first-child h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.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;
  flex-wrap: wrap;
  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 {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
}

.content {
  min-width: 0;
  display: grid;
  gap: 22px;
}

.online-content {
  gap: 34px;
}

.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;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-weight: 700;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

input,
select,
textarea,
button {
  width: 100%;
  font: inherit;
}

input,
select,
textarea {
  min-width: 0;
  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;
}

.product-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.product-card {
  display: grid;
  gap: 5px;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.product-card span {
  font-size: 18px;
  font-weight: 800;
}

.product-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.product-card.active {
  border-color: #9cc7ec;
  background: var(--ink);
  color: #fff;
}

.product-card.active small {
  color: #d0d5dd;
}

.product-panel {
  display: none;
}

.product-panel.active {
  display: grid;
  gap: 14px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 400px);
  justify-content: center;
  gap: 24px;
}

.choice-card {
  display: grid;
  justify-items: center;
  align-content: center;
  width: 400px;
  height: 400px;
  padding: 28px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-align: center;
}

.choice-card:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.choice-card strong {
  font-size: 28px;
  line-height: 1.15;
}

.choice-card span {
  max-width: 420px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 400;
}

.subscription-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) minmax(180px, 1fr);
  gap: 16px;
  align-items: end;
  margin-top: 18px;
}

.section-note {
  margin-bottom: 4px;
}

.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;
}

.support-card {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.support-card strong {
  color: var(--text);
}

.support-card a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.support-card a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.entry-card .support-card {
  margin-top: 22px;
}

.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;
}

.audio-thumb {
  width: 220px;
  max-width: 100%;
}

.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,
.review-media audio {
  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;
}

.compact-notice {
  margin: 14px 0 0;
}

.compact-notice p {
  color: #344054;
  font-size: 13px;
  line-height: 1.45;
}

.price-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.price-summary strong {
  font-size: 22px;
}

.payment-followup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.ad-edit-grid {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.ad-edit-grid input,
.ad-edit-grid select {
  min-height: 34px;
  font-size: 12px;
}

.inline-actions {
  display: grid;
  gap: 8px;
  min-width: 160px;
}

.inline-actions button {
  min-height: 34px;
}

@media (max-width: 980px) {
  .topbar,
  .shell,
  .admin-shell,
  .two-col,
  .three-col,
  .file-grid,
  .filters,
  .preview-layout,
  .product-menu,
  .subscription-actions,
  .payment-followup,
  .review-card {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    justify-items: start;
  }

  .menu-toggle {
    display: inline-grid;
    place-content: center;
    justify-self: end;
    grid-column: 2;
    grid-row: 1;
  }

  .topbar > div:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .topbar nav {
    width: 100%;
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.menu-open .topbar nav {
    display: grid;
  }

  .nav-link {
    justify-content: center;
    min-width: 0;
    text-align: center;
  }

  .topbar > div:first-child::before {
    width: 110px;
    height: 34px;
    flex-basis: 110px;
  }

  .shell,
  .admin-shell {
    width: min(100% - 24px, 760px);
  }

  .sidebar {
    position: static;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    gap: 12px;
    padding: 14px 12px;
  }

  .topbar nav,
  .tabs,
  .button-row {
    grid-template-columns: 1fr;
  }

  .shell,
  .admin-shell,
  .entry-shell,
  .wide-entry {
    width: calc(100% - 16px);
    margin-top: 12px;
  }

  .panel {
    padding: 16px;
  }

  .panel-head,
  .price-summary {
    display: grid;
  }

  table {
    min-width: 620px;
  }

  .embed-code {
    max-width: 100%;
  }

  .choice-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .choice-card {
    width: 100%;
    height: auto;
    min-height: 44px;
    padding: 0 18px;
  }

  .choice-card strong {
    font-size: 17px;
  }
}
