:root {
  --bg: #f5f2ec;
  --panel: #fffdf8;
  --ink: #171d24;
  --muted: #68727c;
  --line: #ddd7cc;
  --blue: #225d9c;
  --green: #1f7a52;
  --green-soft: #e5f3eb;
  --amber: #a76716;
  --amber-soft: #fff1d8;
  --shadow: 0 18px 48px rgba(23, 29, 36, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
textarea {
  font: inherit;
}

button,
.download-button,
.secondary-link {
  border: 0;
  border-radius: 7px;
  min-height: 42px;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

button,
.download-button {
  background: var(--ink);
  color: #fff;
}

button.secondary,
.secondary-link {
  background: #ebe5dc;
  color: var(--ink);
}

.publish-shell {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 24px 0;
}

.publish-header,
.section-head,
.primary-actions,
.tabs,
.asset-actions,
.advanced-grid {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.publish-header {
  justify-content: space-between;
  margin-bottom: 18px;
}

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

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: contain;
  background: #fffaf1;
  border: 1px solid rgba(23, 29, 36, 0.12);
  padding: 4px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 850;
  margin-bottom: 7px;
}

.publish-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.copy-column,
.asset-column,
.calendar-panel,
.advanced-tools {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.calendar-panel {
  margin-bottom: 18px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.pill,
.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.tabs {
  margin-bottom: 10px;
}

.tab {
  background: #ebe5dc;
  color: var(--ink);
}

.tab.active {
  background: var(--blue);
  color: #fff;
}

textarea {
  width: 100%;
  min-height: 610px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fffdfa;
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
}

.primary-actions {
  margin-bottom: 12px;
}

.calendar-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: 8px;
  max-height: 318px;
  overflow: auto;
  padding-right: 2px;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 118px;
  padding: 11px;
  text-align: left;
  background: #f2ece2;
  color: var(--ink);
  border: 1px solid transparent;
}

.calendar-day.active {
  background: #fffdfa;
  color: var(--ink);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.calendar-date {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-topic {
  display: -webkit-box;
  min-height: 38px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.calendar-people {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.calendar-people span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(23, 29, 36, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.calendar-people span.done {
  background: var(--green-soft);
  color: var(--green);
}

.visual-preview {
  aspect-ratio: 4 / 5;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f1e7;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.visual-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.prompt-preview {
  padding: 18px;
  max-height: 520px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
}

.asset-actions {
  margin-top: 12px;
}

.download-button.disabled,
.secondary-link.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.asset-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-top: 9px;
}

.advanced-tools {
  margin-top: 16px;
  color: var(--muted);
}

.advanced-tools summary {
  cursor: pointer;
  font-weight: 850;
  color: var(--ink);
}

.advanced-grid {
  margin: 14px 0;
}

code {
  display: block;
  color: #26313b;
  line-height: 1.4;
  word-break: break-word;
}

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.18s ease;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 800;
}

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

@media (max-width: 980px) {
  .publish-shell {
    width: min(100vw - 24px, 720px);
    padding: 14px 0;
  }

  .publish-card {
    grid-template-columns: 1fr;
  }

  .publish-header,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  textarea {
    min-height: 420px;
  }

  .calendar-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 360px;
  }

  .calendar-day {
    min-height: 104px;
  }
}
