:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --text: #17201d;
  --muted: #5d6965;
  --line: #d7ddd9;
  --panel: #ffffff;
  --accent: #1d6b54;
  --accent-dark: #15503f;
  --warn: #9a5a00;
  --error: #a23333;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

button,
.button-link {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #33423d;
}

button.secondary:hover {
  background: #24302c;
}

.topbar {
  align-items: center;
  background: #16231f;
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 48px);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.topbar-actions form {
  margin: 0;
}

.eyebrow {
  color: #a9c6bc;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 20px;
  margin-bottom: 18px;
}

main {
  margin: 0 auto;
  max-width: 1280px;
  padding: 24px clamp(14px, 3vw, 32px) 48px;
}

.status-band {
  align-items: stretch;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.status-band > div {
  background: #e7efeb;
  border: 1px solid #cad8d1;
  border-radius: 8px;
  padding: 16px;
}

.metric {
  display: block;
  font-size: 32px;
  font-weight: 800;
}

.label,
.sync-state span,
.section-title span,
small {
  color: var(--muted);
}

.sync-state {
  grid-column: span 1;
}

.sync-state strong,
.sync-state span {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
}

.side-stack {
  display: grid;
  gap: 18px;
}

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

.composer {
  margin-bottom: 18px;
}

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

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  margin-bottom: 14px;
}

input,
textarea {
  border: 1px solid #bfcbc6;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 11px 12px;
  width: 100%;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 16px;
  padding: 14px;
}

legend {
  font-weight: 800;
  padding: 0 6px;
}

.checkline {
  align-items: flex-start;
  display: grid;
  gap: 10px;
  grid-template-columns: 20px 1fr;
  margin-bottom: 12px;
}

.checkline input {
  margin-top: 4px;
  width: 18px;
}

.checkline small {
  display: block;
  font-weight: 400;
}

.video-list {
  display: grid;
  gap: 10px;
}

.video-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 120px 1fr;
  padding-bottom: 10px;
}

.video-row img {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  width: 120px;
}

.video-row strong,
.video-row a {
  display: block;
}

.outbox {
  margin-top: 18px;
}

.section-title {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 0;
}

.notice {
  background: #e4efe9;
  border: 1px solid #c6dbd1;
  border-radius: 6px;
  color: #14543f;
  font-weight: 700;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.connection-ok {
  background: #e4efe9;
  border: 1px solid #c6dbd1;
  border-radius: 6px;
  color: #14543f;
  font-weight: 800;
  margin: 0 0 12px;
  padding: 10px 12px;
}

.page-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.page-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  margin: 0;
  padding: 12px;
}

.page-row small {
  display: block;
  font-weight: 400;
}

.draft-list,
.draft-group-list {
  display: grid;
  gap: 14px;
}

.draft {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.draft-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.draft-group-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.draft-group-body {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(160px, 0.45fr) minmax(260px, 1fr) auto;
}

.draft-group-body.no-preview {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.draft-group-body textarea {
  background: #fbfcfb;
  min-height: 170px;
}

.group-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
}

.draft-head,
.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.draft textarea {
  background: #fbfcfb;
  min-height: 190px;
  margin: 12px 0;
}

.draft-title {
  display: block;
  font-weight: 800;
  margin-bottom: 2px;
}

.source {
  color: var(--muted);
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  margin-left: 8px;
  text-transform: uppercase;
}

.media-preview {
  background: #f2f5f3;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 12px;
  overflow: hidden;
}

.draft-group-body .media-preview {
  margin: 0;
}

.media-preview img,
.media-preview video {
  display: block;
  max-height: 280px;
  object-fit: contain;
  width: 100%;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  margin-left: 8px;
  padding: 3px 8px;
  text-transform: uppercase;
}

.draft-group-head .status,
.platform-meta .status {
  margin-left: 6px;
}

.status.draft {
  background: #e4efe9;
  color: #14543f;
}

.status.posted {
  background: #e8edf7;
  color: #254d8a;
}

.status.error {
  background: #f8e7e7;
  color: var(--error);
}

.actions {
  justify-content: flex-start;
}

.actions.compact {
  justify-content: flex-end;
}

.actions.compact button {
  font-size: 14px;
  min-height: 34px;
  padding: 0 10px;
}

.actions form {
  margin: 0;
}

.actions button {
  background: #253630;
}

.actions button:hover {
  background: #111c18;
}

.actions .danger {
  background: #8c2d2d;
}

.actions .danger:hover {
  background: #6f2020;
}

.error {
  color: var(--error);
  font-weight: 700;
}

.external {
  color: var(--muted);
}

.platform-list {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0;
  margin-top: 14px;
}

.platform-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) auto;
  padding: 12px 0;
}

.platform-row + .platform-row {
  border-top: 1px solid var(--line);
}

.platform-meta small {
  display: block;
}

.sr-only {
  height: 1px !important;
  left: -10000px !important;
  overflow: hidden !important;
  position: absolute !important;
  top: auto !important;
  width: 1px !important;
}

.empty {
  color: var(--muted);
  margin: 0;
}

.login-page {
  background: #16231f;
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid #cad8d1;
  border-radius: 8px;
  box-shadow: 0 20px 70px rgb(0 0 0 / 22%);
  margin: 0 auto;
  max-width: 420px;
  padding: 24px;
  width: 100%;
}

.login-panel .eyebrow {
  color: var(--accent);
}

.login-panel h1 {
  font-size: 28px;
  margin-bottom: 20px;
}

.login-error {
  background: #f8e7e7;
  border: 1px solid #e5b6b6;
  border-radius: 6px;
  margin: 0 0 14px;
  padding: 10px 12px;
}

@media (max-width: 900px) {
  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-band,
  .compose-grid,
  .draft-group-body,
  .platform-row,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .draft-group-head,
  .platform-row {
    align-items: flex-start;
  }

  .actions.compact {
    justify-content: flex-start;
  }

  .video-row {
    grid-template-columns: 96px 1fr;
  }

  .video-row img {
    width: 96px;
  }
}
