/* The publishing desk (IDE.Publishing) and the simulated post
   (IDE.PostPreview) — SOCIAL_PUBLISHING §IV.5–§IV.6, SP-6.
   Tokens only (ide.css :root), so a theme change reaches both; every press
   target is at least 44 px square (the programme's contrast-and-target test);
   the preview is a NEUTRAL frame that imitates no service's own look. */

/* ── the desk ───────────────────────────────────────────────────────── */

.pub-overlay {
  position: fixed;
  inset: 0;
  /* The shell's modal level (the admin console's); the one-time "Got it"
     tip stays above it on purpose, as it does there. */
  z-index: 9000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 24px;
}
.pub-overlay[hidden] {
  display: none;
}
.pub-desk {
  display: flex;
  flex-direction: column;
  width: min(1200px, 100%);
  background: var(--bg-panel, #262637);
  color: var(--text, #e0e0f0);
  border: 1px solid var(--border, #3a3a5c);
  border-radius: 10px;
  overflow: hidden;
}
.pub-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #3a3a5c);
  flex-wrap: wrap;
}
.pub-title {
  font-size: 18px;
  margin: 0;
}
.pub-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}
.pub-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: var(--radius, 6px);
  border: 1px solid var(--border, #3a3a5c);
  background: var(--bg-input, #1a1a2a);
  color: var(--text, #e0e0f0);
  font: inherit;
  cursor: pointer;
}
.pub-btn:hover {
  border-color: var(--accent, #6c63ff);
}
.pub-btn:focus-visible {
  outline: 2px solid var(--accent, #6c63ff);
  outline-offset: 2px;
}
/* ⚠ White on the shell's --accent (#6c63ff) is 4.32:1 — under AA's 4.5,
   measured by the SP-6 walk. A pressed or primary button here uses a
   darker accent: white on #5148e6 is 6.1:1. */
.pub-tab.is-on,
.pub-primary {
  background: var(--accent-strong, #5148e6);
  border-color: var(--accent-strong, #5148e6);
  color: #fff;
}
.pub-icon {
  padding: 0;
}
.pub-close {
  margin-left: auto;
}
.pub-say {
  min-height: 1.4em;
  padding: 4px 14px;
  color: var(--text, #e0e0f0);
}
.pub-main {
  display: flex;
  flex: 1;
  min-height: 0;
}
.pub-body {
  flex: 1;
  overflow: auto;
  padding: 10px 14px 20px;
}
.pub-preview {
  width: 380px;
  border-left: 1px solid var(--border, #3a3a5c);
  overflow: auto;
  padding: 10px 14px;
}
.pub-preview[hidden] {
  display: none;
}
.pub-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.pub-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.pub-muted {
  color: var(--text-muted, #8d8daf);
}
.pub-empty {
  padding: 18px 0;
  max-width: 60ch;
}
.pub-card {
  border: 1px solid var(--border, #3a3a5c);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--bg, #1e1e2e);
}
.pub-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pub-card-title {
  font-size: 16px;
  margin: 0;
}
.pub-rhythm {
  margin-top: 4px;
}
.pub-next {
  margin: 6px 0 8px;
  padding: 8px 10px;
  border: 1px dashed var(--border, #3a3a5c);
  border-radius: var(--radius, 6px);
  color: var(--text, #e0e0f0);
}
.pub-place {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border, #3a3a5c);
  font-size: 13px;
}
.pub-post,
.pub-out {
  border-top: 1px solid var(--border, #3a3a5c);
  padding: 8px 0;
}
.pub-post.is-dragging {
  opacity: 0.5;
}
.pub-post.is-drop {
  outline: 2px dashed var(--accent, #6c63ff);
}
.pub-post-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pub-time {
  font-variant-numeric: tabular-nums;
}
.pub-chip {
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-input, #1a1a2a);
  border: 1px solid var(--border, #3a3a5c);
}
.pub-chip-held,
.pub-chip-failed {
  border-color: var(--danger, #e56464);
}
.pub-chip-sent {
  border-color: var(--success, #4caf50);
}
.pub-chip-kit,
.pub-chip-waiting {
  border-color: var(--warn, #e0a800);
}
.pub-note {
  margin-top: 4px;
  color: var(--text, #e0e0f0);
  border-left: 3px solid var(--warn, #e0a800);
  padding-left: 8px;
}
.pub-acts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.pub-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent-hover, #7d75ff);
}
/* CAL-8 — a post kept at a time of its own, with its way back. */
.pub-kept {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
/* The calendar tab is THE calendar's grid (IDE.CalendarView, CAL-8). */
.pub-calendar {
  min-width: 0;
}

/* ── the simulated post (neutral: imitates no service) ──────────────── */

.pp-frame {
  border: 1px solid var(--border, #3a3a5c);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg, #1e1e2e);
  color: var(--text, #e0e0f0);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pp-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.pp-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input, #1a1a2a);
  border: 1px solid var(--border, #3a3a5c);
  font-weight: 600;
}
.pp-who {
  display: flex;
  flex-direction: column;
}
.pp-notice {
  font-size: 12px;
  color: var(--text-muted, #8d8daf);
}
.pp-title {
  font-weight: 600;
}
.pp-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}
.pp-fold {
  display: block;
  margin: 8px 0;
  padding: 4px 8px;
  border-top: 2px dashed var(--accent, #6c63ff);
  font-size: 12px;
  color: var(--text, #e0e0f0);
}
.pp-after {
  opacity: 0.7;
}
.pp-cut {
  border-left: 3px solid var(--danger, #e56464);
  padding-left: 8px;
  font-size: 13px;
}
.pp-cut-label {
  font-weight: 600;
  margin-right: 6px;
}
.pp-cut-text {
  text-decoration: line-through;
  opacity: 0.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.pp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
.pp-grid[data-count="1"] {
  grid-template-columns: 1fr;
}
.pp-pic {
  margin: 0;
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-input, #1a1a2a);
  min-height: 60px;
}
.pp-pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pp-pic-out {
  opacity: 0.4;
  outline: 2px dashed var(--danger, #e56464);
}
/* SP-14 — where each picture is trimmed: the panel whole, the kept part
   outlined, the rest dimmed by the box's own shadow (clipped by the stage) */
.pp-trims-head {
  margin: 4px 0;
  font-size: 13px;
  color: var(--text-muted, #8d8daf);
}
.pp-trims-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
}
.pp-trim {
  margin: 0;
}
.pp-trim-stage {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  line-height: 0;
}
.pp-trim-stage img {
  width: 100%;
  height: auto;
  display: block;
}
.pp-trim-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--accent, #6c8cff);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}
.pp-trim-cut .pp-trim-box {
  border-color: var(--danger, #e56464);
}
.pp-trim-label {
  font-size: 12px;
  margin-top: 2px;
}
.pp-trim-cut .pp-trim-label {
  color: var(--danger, #e56464);
  font-weight: 600;
}
.pp-out-label {
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
}
.pp-link,
.pp-ai {
  font-size: 13px;
  border: 1px solid var(--border, #3a3a5c);
  border-radius: 6px;
  padding: 6px 8px;
}
.pp-count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #8d8daf);
}
.pp-count-full {
  color: var(--warn, #e0a800);
}
.pp-warnings {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}
.pp-error,
.pp-loading {
  color: var(--text-muted, #8d8daf);
}

/* ── a phone ────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .pub-overlay {
    padding: 0;
  }
  .pub-desk {
    border-radius: 0;
  }
  .pub-main {
    flex-direction: column;
    overflow: auto;
  }
  .pub-body {
    overflow: visible;
  }
  .pub-preview {
    width: auto;
    border-left: 0;
    border-top: 1px solid var(--border, #3a3a5c);
  }
  .pub-tabs {
    order: 3;
    flex-basis: 100%;
  }
}

/* SP-7 — where the posts go, said under the calendar's toolbar. */
.pub-cal-where {
  margin: 0 0 8px;
  font-size: 0.9rem;
}
.pub-cal-where p {
  margin: 2px 0;
}

/* ── SP-9 — an email, and a survey invitation, in the ONE frame ──────────
 * An email is met as a LINE IN AN INBOX before anybody reads it, so that is
 * what is drawn above the body: the subject, then the first words a mail
 * program shows beside it. It imitates no particular mail program — the same
 * rule as the social frame it sits inside.
 */
.pp-inbox {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border, #3a3a5c);
  border-left: 3px solid var(--accent, #7aa2f7);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--bg-input, #1a1a2a);
}
.pp-inbox-subject {
  font-weight: 600;
}
.pp-inbox-pre {
  font-size: 13px;
  color: var(--text-muted, #8d8daf);
  /* One line, like an inbox: the rest is what opening it is for. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The body of an email keeps its own line breaks — it is sent as plain text
 * and plain text is what arrives (SP-INV-5). */
.pp-frame[data-kind="email"] .pp-text,
.pp-frame[data-kind="survey"] .pp-text {
  white-space: pre-wrap;
}
/* A queue that cannot send says why, on its own card. */
.pub-cannot-send {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--warn, #e0a800);
  border-left: 3px solid var(--warn, #e0a800);
  padding-left: 8px;
}
/* SP-10 — which version a post is, when *Try both* put two in the line. */
.pub-variant {
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border, #3a3a5c);
  color: var(--text-muted, #8d8daf);
  white-space: nowrap;
}

/* CG-6 — the post the desk was opened AT (the app's Waiting for you). */
.pub-post.pub-focus {
  outline: 2px solid var(--accent, #6c63ff);
  outline-offset: 2px;
  border-radius: 8px;
}
