:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #52616b;
  --line: #d9e0e5;
  --panel: #ffffff;
  --bg: #f5f7f8;
  --green: #146c43;
  --blue: #164c96;
  --amber: #805b10;
  --red: #9f2d20;
  --shadow: 0 14px 35px rgba(28, 42, 52, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea {
  font: inherit;
}

.portal-shell {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.portal-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.summary {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
}

.header-actions,
.post-actions,
.preview-links,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.button.blue {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button.warning {
  border-color: #e2c46d;
  background: #fff7df;
  color: var(--amber);
}

.button.danger {
  border-color: #e4aaa2;
  background: #fff0ee;
  color: var(--red);
}

.button.subtle {
  background: #f8fafb;
}

.status-panel,
.batch-meta {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px 16px;
}

.status-panel:empty {
  display: none;
}

.status-panel.error {
  border-color: #e4aaa2;
  background: #fff0ee;
  color: var(--red);
}

.status-panel.ok {
  border-color: #afd6bf;
  background: #effaf3;
  color: #0d5432;
}

.status-panel.warn {
  border-color: #ead8a8;
  background: #fff9e8;
  color: #47380b;
}

.posts {
  margin-top: 18px;
}

.post {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.focused-item {
  outline: 3px solid rgba(22, 76, 150, 0.32);
  outline-offset: 3px;
}

.post-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.post h2 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.25;
}

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

.status-pill {
  display: inline-flex;
  margin-top: 8px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef4f8;
  color: #274153;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.approved {
  background: #e8f7ee;
  color: var(--green);
}

.status-pill.skipped {
  background: #fff0ee;
  color: var(--red);
}

.status-pill.edit_requested {
  background: #fff7df;
  color: var(--amber);
}

.status-pill.revision_ready {
  background: #eef4ff;
  color: var(--blue);
}

.revision-notice {
  margin-top: 10px;
  border: 1px solid #cbdcff;
  border-radius: 8px;
  background: #f6f9ff;
  padding: 10px;
  color: var(--ink);
  font-size: 13px;
}

.revision-notice p {
  margin: 6px 0 0;
}

.revision-notice span {
  color: var(--muted);
  font-weight: 700;
}

.revision-notice .human-review {
  color: var(--amber);
}

.post-body {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.4fr);
  gap: 18px;
  padding: 18px;
}

.image-panel img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f3;
}

.image-path {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.preview {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.preview h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.caption p {
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

.cta {
  display: inline-block;
  margin-top: 4px;
  border-radius: 6px;
  padding: 5px 8px;
  background: #eef4f8;
  color: #274153;
  font-size: 13px;
  font-weight: 700;
}

.schedule-pill {
  display: inline-block;
  margin-top: 8px;
  margin-left: 6px;
  border-radius: 6px;
  padding: 5px 8px;
  background: #e8f7ee;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.schedule-pill.error {
  background: #fff0ee;
  color: var(--red);
}

.schedule-pill.queued {
  background: #eef4f8;
  color: #274153;
}

.preview-links {
  margin-top: 12px;
}

.native-link[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(23, 32, 38, 0.36);
}

.confirm-dialog form {
  padding: 20px;
}

.confirm-dialog h2 {
  margin: 0 0 8px;
}

.field {
  display: grid;
  gap: 6px;
  margin: 16px 0;
  color: var(--muted);
  font-weight: 700;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.blog-body {
  padding: 18px;
}

.recovery-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  padding: 18px;
}

.recovery-preview .meta {
  margin-top: 10px;
}

.blog-preview {
  max-width: 820px;
}

.blog-copy {
  margin-top: 14px;
}

@media (max-width: 860px) {
  .portal-header,
  .post-head,
  .post-body,
  .preview-grid,
  .recovery-body {
    grid-template-columns: 1fr;
  }
}
