/* --------------------------------------------------
   Publish modal
   Aligned with editor.css palette
-------------------------------------------------- */

#app-modal[aria-hidden="false"]:has(.publish-modal-wrap) .modal__dialog {
  width: min(920px, calc(100vw - 32px));
  max-width: min(920px, calc(100vw - 32px));
}

#app-modal[aria-hidden="false"]:has(.publish-modal-wrap) .modal__body {
  max-height: min(76vh, 820px);
  overflow: auto;
  background: var(--surface-page);
}

.publish-modal-wrap {
  display: grid;
  gap: 16px;
  color: var(--text-strong);
}

/* Hero */

.publish-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 74%, #f6fbf6 100%);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
}

.publish-hero-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--ui-accent);
  background: var(--ui-accent);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(56, 142, 60, 0.24);
}

.publish-hero-title {
  margin: 0 0 4px;
  color: var(--ui-accent-dark);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.publish-hero-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Sticky publication status */

.publish-status-panel {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--surface-border-soft);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.11);
  backdrop-filter: blur(8px);
}

.publish-status-panel[data-tone="busy"] {
  border-color: var(--ui-accent);
  background: linear-gradient(135deg, #ffffff 0%, #f6fbf6 100%);
}

.publish-status-panel[data-tone="success"] {
  border-color: #86efac;
  background: #f0fdf4;
}


.publish-status-panel[data-tone="preview"] {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.publish-status-panel[data-tone="preview"] .publish-status-badge {
  background: #2563eb;
  color: #ffffff;
}

.publish-status[data-tone="preview"] {
  color: #1d4ed8;
}

.publish-status-panel[data-tone="error"] {
  border-color: #fecaca;
  background: #fff1f2;
}


.publish-status-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.publish-status-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.publish-status-panel[data-tone="busy"] .publish-status-badge {
  background: var(--ui-accent);
  color: #ffffff;
}

.publish-status-panel[data-tone="success"] .publish-status-badge {
  background: #16a34a;
  color: #ffffff;
}

.publish-status-panel[data-tone="error"] .publish-status-badge {
  background: #dc2626;
  color: #ffffff;
}

.publish-status-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.publish-status-title {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.publish-inline-actions--status {
  justify-content: flex-start;
  padding-top: 2px;
}

/* Sections */

.publish-section {
  overflow: hidden;
  border: 1px solid var(--surface-border-soft);
  border-radius: 18px;
  background: var(--surface-card);
  box-shadow: var(--shadow);
}

.publish-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--surface-border-soft);
  background: #f8fafc;
}

.publish-section-title {
  color: var(--text-strong);
  font-weight: 850;
  letter-spacing: -0.01em;
}

.publish-section-help {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.35;
}

.publish-section-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.publish-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 720px) {
  .publish-grid-2 {
    grid-template-columns: 1fr;
  }
}




/* Fields */

.publish-field {
  display: grid;
  gap: 7px;
}

.publish-field label,
.publish-check-card strong {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 800;
}

.publish-field input,
.publish-field select {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  background: #ffffff;
  color: #111;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.publish-field input:focus,
.publish-field select:focus {
  border-color: var(--ui-accent) !important;
  box-shadow: 0 0 0 3px var(--ui-accent-soft) !important;
}

.publish-field-hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.publish-required {
  color: #dc2626;
  font-weight: 950;
}

.publish-credentials-hint {
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff1f2;
  color: #a30d0d;
  font-weight: 750;
}

.publish-credentials-hint[data-tone="success"] {
  background: #f0fdf4;
  color: #166534;
}


/* Backup */

.publish-check-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--surface-border-soft);
  border-radius: 15px;
  background: var(--ui-accent-extrasoft);
}

.publish-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.publish-check-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--ui-accent);
}

.publish-check-copy {
  display: grid;
  gap: 3px;
}

#publish-backup-name-row[hidden],
#publish-backup-name-row.is-hidden {
  display: none !important;
}

/* Actions */

.publish-inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.publish-secondary-btn {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--ui-accent);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ui-accent-dark);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.publish-secondary-btn:hover {
  border-color: var(--ui-accent);
  background: var(--ui-accent-extrasoft);
  color: var(--ui-accent-dark);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.publish-secondary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.publish-status {
  min-height: 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
}

.publish-status[data-tone="busy"] {
  color: var(--ui-accent-dark);
}

.publish-status[data-tone="success"] {
  color: #0a7a2f;
}

.publish-status[data-tone="error"] {
  color: #a30d0d;
}

/* Result + details */

.publish-result-host,
.publish-details-host {
  display: grid;
  gap: 14px;
}

.publish-status-panel .publish-result-host {
  gap: 10px;
}

.publish-result-host:empty,
.publish-details-host:empty {
  display: none;
}

.publish-result-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--surface-border-soft);
  border-radius: 18px;
  background: var(--surface-card);
  box-shadow: var(--shadow);
}

.publish-result-box.is-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.publish-result-box.is-error {
  border-color: #fecaca;
  background: #fff1f2;
}

.publish-result-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.publish-result-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--ui-accent);
  color: #ffffff;
  font-weight: 950;
}

.publish-result-box.is-error .publish-result-icon {
  background: #dc2626;
}

.publish-result-success,
.publish-result-error {
  font-size: 16px;
  font-weight: 900;
}

.publish-result-success {
  color: #0a7a2f;
}

.publish-result-error {
  color: #a30d0d;
}

.publish-result-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  line-height: 1.4;
}

.publish-result-box.is-success .publish-result-subtitle {
  color: #166534;
}

.publish-result-box.is-error .publish-result-subtitle {
  color: #a30d0d;
}

.publish-status-panel .publish-result-box {
  padding: 12px;
  border-radius: 15px;
  box-shadow: none;
}

/* Warnings / advisory */

.publish-warning {
  padding: 10px 12px;
  border: 1px solid #f5df8e;
  border-radius: 12px;
  background: #fffaf0;
  color: #6b5a2b;
  font-size: 13px;
  font-weight: 700;
}

.publish-advisory {
  padding: 10px 12px;
  border: 1px solid var(--surface-border-soft);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

/* Readiness cards */

.publish-readiness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 720px) {
  .publish-readiness-grid {
    grid-template-columns: 1fr;
  }
}

.publish-readiness-card {
  padding: 12px;
  border: 1px solid var(--surface-border-soft);
  border-radius: 15px;
  background: var(--surface-card);
}

.publish-readiness-card.is-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.publish-readiness-card.is-blocking {
  border-color: #f5df8e;
  background: #fffaf0;
}

.publish-readiness-card.is-info {
  border-color: var(--surface-border-soft);
  background: #f8fafc;
}

.publish-readiness-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.publish-readiness-value {
  margin-top: 4px;
  color: var(--text-strong);
  font-size: 17px;
  font-weight: 950;
}

/* Graph/debug panels */

.publish-debug-summary,
.publish-empty-state {
  padding: 14px;
  border: 1px solid var(--surface-border-soft);
  border-radius: 15px;
  background: #f8fafc;
}

.publish-debug-title,
.publish-split-title {
  margin-bottom: 5px;
  color: var(--text-strong);
  font-weight: 900;
}

.publish-debug-subtitle,
.publish-split-meta {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.publish-split-wrap {
  display: grid;
  gap: 10px;
}

.publish-split-details {
  overflow: hidden;
  border: 1px solid var(--surface-border-soft);
  border-radius: 15px;
  background: var(--surface-card);
}

.publish-result-raw summary,
.publish-split-summary {
  cursor: pointer;
}

.publish-split-summary {
  padding: 12px 14px;
  background: #f8fafc;
  color: var(--text-strong);
  font-weight: 850;
}

.publish-split-body {
  padding: 12px;
}

.publish-code-panel .ttl-wrap {
  max-height: 420px;
  overflow: auto;
}

.publish-json-pre {
  max-height: 360px;
  overflow: auto;
  border-radius: 12px;
  white-space: pre-wrap;
}

/* Published resource shortcut */
.publish-result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.publish-view-resource-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  text-decoration: none;
}

.publish-view-resource-btn::after {
  content: "↗";
  margin-left: 7px;
  font-weight: 950;
}
