/* ============================================
   Proxy Blog Dashboard — Dark Futuristic Theme
   ============================================ */

/* ---------- Reset & Base ---------- */
:root {
  --accent: #58a6ff;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  min-height: 100vh;
  line-height: 1.6;
}

a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Login Page ---------- */
#login-page {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background: #161b22;
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 0 30px rgba(88, 166, 255, 0.1), 0 0 80px rgba(88, 166, 255, 0.05);
  animation: cardPulse 3s ease-in-out infinite;
}

@keyframes cardPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(88, 166, 255, 0.1), 0 0 80px rgba(88, 166, 255, 0.05); }
  50% { box-shadow: 0 0 40px rgba(88, 166, 255, 0.18), 0 0 100px rgba(88, 166, 255, 0.08); }
}

.login-card h1 {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  text-align: center;
  font-size: 0.8rem;
  color: #484f58;
  font-family: 'Courier New', monospace;
  margin-bottom: 2rem;
  letter-spacing: 0.5px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #8b949e;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.btn-primary {
  width: 100%;
  padding: 0.7rem;
  background: #58a6ff;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s, transform 0.15s;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: #79b8ff;
  box-shadow: 0 0 20px rgba(88, 166, 255, 0.4);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-toggle {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: #8b949e;
}

.login-toggle a {
  cursor: pointer;
  font-weight: 500;
  color: #58a6ff;
  transition: text-shadow 0.2s;
}
.login-toggle a:hover {
  text-shadow: 0 0 8px rgba(88, 166, 255, 0.4);
}

.login-blue {
  color: #58a6ff;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.4);
}

#auth-error {
  color: #f85149;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.75rem;
  min-height: 1.2em;
}
#auth-error.verification-notice {
  color: #58a6ff;
}

/* ---------- Cockpit Transition ---------- */

/* Beat 1: Auth success button flash */
.auth-success-flash {
  background: #79b8ff !important;
  box-shadow: 0 0 30px rgba(88, 166, 255, 0.6), 0 0 60px rgba(88, 166, 255, 0.3) !important;
  transform: scale(1.02);
  transition: all 0.2s ease;
}

/* Crossfade: login out */
.fade-out {
  animation: fadeOut 0.4s ease forwards;
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Crossfade: dashboard in */
.fade-in {
  animation: fadeIn 0.5s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Systems Online indicator */
.systems-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.systems-status.status-visible {
  opacity: 1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #333;
  display: inline-block;
  transition: background 0.2s, box-shadow 0.2s;
}

/* Flicker animation — light warming up */
.status-dot.dot-flicker {
  animation: dotFlicker 0.6s steps(1) forwards;
}
@keyframes dotFlicker {
  0%   { background: #333; box-shadow: none; }
  15%  { background: #3fb950; box-shadow: 0 0 6px rgba(63, 185, 80, 0.6); }
  25%  { background: #333; box-shadow: none; }
  40%  { background: #3fb950; box-shadow: 0 0 8px rgba(63, 185, 80, 0.7); }
  55%  { background: #1a3a1a; box-shadow: none; }
  75%  { background: #3fb950; box-shadow: 0 0 10px rgba(63, 185, 80, 0.8); }
  100% { background: #3fb950; box-shadow: 0 0 10px rgba(63, 185, 80, 0.8); }
}

/* Steady glow with visible breathing */
.status-dot.dot-steady {
  background: #3fb950;
  box-shadow: 0 0 10px rgba(63, 185, 80, 0.6);
  animation: dotPulse 3s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(63, 185, 80, 0.4); background: #37a349; }
  50% { box-shadow: 0 0 18px rgba(63, 185, 80, 0.9), 0 0 30px rgba(63, 185, 80, 0.3); background: #3fb950; }
}

/* LED text style — shared by Systems Online, SEO threshold, and Focus LED */
.led-text,
.status-text,
.threshold-text,
.focus-text {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-text {
  color: #d4956a;
  text-shadow: 0 0 10px rgba(212, 149, 106, 0.4);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.status-text.text-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- Dashboard Layout ---------- */
#dashboard-page {
  display: none;
  min-height: 100vh;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(88, 166, 255, 0.012) 3px,
      rgba(88, 166, 255, 0.012) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 3px,
      rgba(88, 166, 255, 0.012) 3px,
      rgba(88, 166, 255, 0.012) 4px
    );
}

/* ---------- Top Nav ---------- */
.top-nav {
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.nav-brand span {
  color: #58a6ff;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.4);
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-center label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

#site-selector {
  background: #0d1117;
  color: #e6edf3;
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 220px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2358a6ff' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

#site-selector:focus {
  outline: none;
  border-color: #79b8ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

#site-selector:hover {
  border-color: #79b8ff;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-email {
  font-size: 0.8rem;
  color: #8b949e;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: transparent;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.btn-logout:hover {
  color: #f85149;
  border-color: #f85149;
}

/* ---------- Main Content ---------- */
.main-content {
  max-width: 1320px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.top-controls {
  width: 100%;
}
.columns-wrap {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
}
.editor-column {
  flex: 1;
  min-width: 0;
  max-width: 900px;
}
.seo-column {
  width: 340px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}
@media (max-width: 1200px) {
  .columns-wrap { flex-direction: column; max-width: 900px; }
  .seo-column { width: 100%; position: static; }
}

.section-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-card h2 {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #30363d;
}

/* ---------- Form Fields ---------- */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.field-group {
  margin-bottom: 1rem;
}

.field-group label {
  display: block;
  font-size: 0.85rem;
  color: #8b949e;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.field-group textarea {
  resize: vertical;
}

.char-count {
  font-size: 0.75rem;
  color: #8b949e;
  text-align: right;
  margin-top: 0.25rem;
}

.char-count.over-limit {
  color: #f85149;
  font-weight: 600;
}

/* ---------- Image Upload ---------- */
.image-upload-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-upload:hover {
  border-color: #58a6ff;
}

#image-input {
  display: none;
}

.image-preview {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #30363d;
  display: none;
}

.image-filename {
  font-size: 0.8rem;
  color: #8b949e;
}

/* ---------- Quill Editor ---------- */
.editor-wrapper {
  background: #fff;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  overflow: hidden;
}

.editor-wrapper .ql-toolbar.ql-snow {
  border: none;
  border-bottom: 1px solid #d0d7de;
  background: #f6f8fa;
}

.editor-wrapper .ql-container.ql-snow {
  border: none;
  font-size: 1rem;
  font-family: 'Segoe UI', -apple-system, sans-serif;
}

.editor-wrapper .ql-editor {
  min-height: 400px;
  padding: 1.25rem;
  color: #1a1a1a;
  line-height: 1.7;
  background: #fff;
}

.editor-wrapper .ql-editor h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 1rem 0 0.5rem;
  padding: 0;
  line-height: 1.3;
  border: none;
  border-bottom: none;
}

.editor-wrapper .ql-editor h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0.75rem 0 0.4rem;
  padding: 0;
  line-height: 1.3;
}

.editor-wrapper .ql-editor p {
  margin-bottom: 0.75rem;
  color: #1a1a1a;
}

.editor-wrapper .ql-editor blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
  color: #444;
  margin: 0.75rem 0;
}

.editor-wrapper .ql-editor ul,
.editor-wrapper .ql-editor ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
  color: #1a1a1a;
}

.editor-wrapper .ql-editor li {
  margin-bottom: 0.3rem;
}

.editor-wrapper .ql-editor a {
  color: var(--accent);
}

/* Quill toolbar dropdown fixes for dark theme surrounding */
.ql-snow .ql-picker-label {
  color: #1a1a1a;
}

.ql-snow .ql-picker-options {
  background: #fff;
  border: 1px solid #d0d7de;
}

.ql-snow .ql-picker-item {
  color: #1a1a1a;
}

.ql-snow .ql-stroke {
  stroke: #444;
}

.ql-snow .ql-fill {
  fill: #444;
}

.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--accent);
}

.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill {
  fill: var(--accent);
}

.ql-snow .ql-picker-label:hover,
.ql-snow .ql-picker-item:hover {
  color: var(--accent);
}

.editor-wrapper .ql-editor.ql-blank::before {
  color: #8b949e;
  font-style: italic;
}

/* ---------- LED Readout (shared) ---------- */
.led-readout {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Word Gauge ---------- */
.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 0;
  margin-top: 4px;
}
.word-gauge {
  color: #3a3a3a;
  text-shadow: none;
  transition: color 0.4s, text-shadow 0.4s;
}
.word-gauge.warm {
  color: #d29922;
  text-shadow: 0 0 8px rgba(210, 153, 34, 0.4);
}
.word-gauge.hot {
  color: #3fb950;
  text-shadow: 0 0 8px rgba(63, 185, 80, 0.4);
}

/* ---------- Draft Indicator ---------- */
.draft-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.4s;
}
.draft-indicator.visible {
  opacity: 1;
}
.draft-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.6);
}
.draft-text {
  color: #3fb950;
  text-shadow: 0 0 6px rgba(63, 185, 80, 0.3);
  font-size: 0.65rem;
}

/* ---------- Nav Clock ---------- */
.nav-clock {
  color: #4a5568;
  font-size: 0.68rem;
  margin-right: 8px;
}

/* ---------- Post Count ---------- */
.post-count {
  color: #4a5568;
  font-size: 0.68rem;
  margin-left: 10px;
}
.post-count.loaded {
  color: #8b949e;
}

/* ---------- Action Buttons ---------- */
.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-secondary {
  background: transparent;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.6rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
  border-color: #58a6ff;
  color: #58a6ff;
}

.btn-publish {
  background: #1e3a5f;
  color: rgba(255,255,255,0.4);
  border: none;
  border-radius: 6px;
  padding: 0.6rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: not-allowed;
  transition: background 0.4s, box-shadow 0.4s, color 0.4s, transform 0.15s;
}

.btn-publish:hover {
  background: #1e3a5f;
}

.btn-publish:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Publish powered on — Min Thresholds Met */
.btn-publish.powered-on {
  background: #58a6ff;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(88, 166, 255, 0.3);
}
.btn-publish.powered-on:hover {
  background: #79b8ff;
  box-shadow: 0 0 25px rgba(88, 166, 255, 0.45);
  transform: translateY(-1px);
}

/* ---------- Preview Modal ---------- */
.preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.preview-overlay.active {
  display: block;
}

.preview-container {
  background: #fff;
  max-width: 800px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}

.preview-header h3 {
  color: #fff;
  font-size: 1rem;
}

.preview-header-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-close-preview {
  background: transparent;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-close-preview:hover {
  color: #f85149;
  border-color: #f85149;
}

.btn-publish-preview {
  background: #58a6ff;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-publish-preview:hover {
  background: #79b8ff;
}

.preview-body {
  padding: 2rem 2.5rem;
  color: #1a1a1a;
  line-height: 1.8;
}

.preview-featured-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.preview-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: #666;
}

.preview-category-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.preview-body h1 {
  font-size: 2rem;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.preview-content h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
}

.preview-content h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.preview-content p {
  margin-bottom: 1rem;
}

.preview-content ul,
.preview-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.preview-content blockquote {
  border-left: 4px solid #ddd;
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  color: #555;
  font-style: italic;
}

.preview-content a {
  color: #58a6ff;
}

/* ---------- Status Messages ---------- */
.status-message {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
}

.status-message.visible {
  transform: translateY(0);
  opacity: 1;
}

.status-message.success {
  background: #58a6ff;
  color: #fff;
  box-shadow: 0 4px 20px rgba(88, 166, 255, 0.3);
}

.status-message.error {
  background: #da3633;
  color: #fff;
  box-shadow: 0 4px 20px rgba(218, 54, 51, 0.3);
}

.status-message.info {
  background: #161b22;
  color: #c9d1d9;
  border: 1px solid #30363d;
}

/* ---------- Publish Progress ---------- */
.publish-progress {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
}

.publish-progress.active {
  display: block;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: #8b949e;
}

.progress-step.active {
  color: #58a6ff;
}

.progress-step.done {
  color: #3fb950;
}

.progress-step.error {
  color: #f85149;
}

.progress-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- New Category Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 5000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
}

.modal-box h3 {
  color: #fff;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.modal-box input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.modal-box input:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .top-nav {
    flex-wrap: wrap;
    height: auto;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .nav-center {
    order: 3;
    width: 100%;
  }

  #site-selector {
    width: 100%;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .user-email {
    display: none;
  }

  .preview-body {
    padding: 1.5rem 1rem;
  }

  .action-row {
    flex-direction: column;
  }

  .action-row button {
    width: 100%;
  }
}

/* Settings Button — hidden by default, add ?admin=true to URL to show */
.btn-settings {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.btn-settings.visible {
  display: inline-block;
}
.btn-settings:hover {
  border-color: var(--accent);
}

/* Settings Modal — uses .modal-overlay base (display:none by default, flex when .active) */
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
}
.modal-card h2 {
  color: #fff;
  font-size: 1.3rem;
  margin-bottom: 8px;
}
.modal-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
.btn-secondary {
  background: var(--border);
  color: #ccc;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.btn-secondary:hover {
  background: #444c56;
}
.token-status {
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 20px;
}
.token-status.success { color: #3fb950; }
.token-status.error { color: #f85149; }

/* Helper hint text on labels */
.label-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: #8b949e;
  letter-spacing: 0;
}

/* Mode Toggle (New Post / Edit Existing) */
.mode-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.mode-btn {
  border: none;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s, transform 0.15s;
  letter-spacing: 0.3px;
}
.mode-btn:active {
  transform: scale(0.97);
}

/* New Post button — blue default, green when active */
.mode-btn-new {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(88, 166, 255, 0.25);
  transition: background 0.25s, color 0.25s, box-shadow 0.25s, transform 0.2s;
}
.mode-btn-new:hover {
  background: #79b8ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(88, 166, 255, 0.45);
}
.mode-btn-new.active {
  background: #2ea043;
  color: #fff;
  box-shadow: 0 0 14px rgba(46, 160, 67, 0.45), 0 2px 12px rgba(46, 160, 67, 0.3);
}
.mode-btn-new.active:hover {
  background: #36b34d;
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(46, 160, 67, 0.55), 0 4px 16px rgba(46, 160, 67, 0.35);
}

/* Edit Existing button — amber outline */
.mode-btn-edit {
  background: transparent;
  color: #E5A00D;
  border: 2px solid #E5A00D;
  box-shadow: none;
}
.mode-btn-edit:hover {
  background: rgba(229, 160, 13, 0.1);
  box-shadow: 0 2px 12px rgba(229, 160, 13, 0.2);
}
.mode-btn-edit.active {
  background: #E5A00D;
  color: #0d1117;
  box-shadow: 0 2px 12px rgba(229, 160, 13, 0.3);
}

/* Existing Posts Panel */
.existing-posts-panel {
  margin-bottom: 24px;
}
.panel-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.loading-posts {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 20px;
  text-align: center;
}
.post-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.post-list-item:hover {
  border-color: var(--accent);
  background: #161b22;
}
.post-list-item-info {
  flex: 1;
  min-width: 0;
}
.post-list-item-title {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-list-item-meta {
  color: var(--muted);
  font-size: 0.78rem;
}
.post-list-item-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 12px;
  transition: opacity 0.2s;
}
.post-list-item-btn:hover {
  opacity: 0.85;
}

/* Edit mode indicator */
.edit-indicator {
  display: none;
  background: #1c2d3f;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--accent);
  align-items: center;
  justify-content: space-between;
}
.edit-indicator.active {
  display: flex;
}
.edit-indicator .cancel-edit {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.2s;
}
.edit-indicator .cancel-edit:hover {
  border-color: #f85149;
  color: #f85149;
}

/* Existing image preview (edit mode) */
.existing-image-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 10px;
}
.existing-image-thumb {
  width: 80px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.existing-image-info {
  flex: 1;
  min-width: 0;
}
.existing-image-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #3fb950;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
}
.existing-image-path {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-change-image {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}
.btn-change-image:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Site context label next to Post Details */
.site-context {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0;
  text-transform: none;
}

/* ============================================
   SEO ASSISTANT PANEL
============================================ */
.seo-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px 20px;
  border-top: 3px solid #58a6ff;
}
.seo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.seo-title {
  font-size: 1rem;
  font-weight: 700;
  color: #c9d1d9;
  letter-spacing: 0.5px;
}
.seo-title span {
  color: #58a6ff;
}
/* SEO Threshold LED indicator */
.seo-threshold {
  display: flex;
  align-items: center;
  gap: 8px;
}
.threshold-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2a2a2a;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
  display: inline-block;
  transition: background 0.3s, box-shadow 0.3s;
}
.threshold-text {
  color: #3a3a3a;
  text-shadow: none;
  transition: color 0.4s, text-shadow 0.4s;
}

/* Threshold met — light powers on */
.seo-threshold.met .threshold-dot {
  background: #3fb950;
  box-shadow: 0 0 10px rgba(63, 185, 80, 0.6);
  animation: dotPulse 3s ease-in-out infinite;
}
.seo-threshold.met .threshold-text {
  color: #d4956a;
  text-shadow: 0 0 10px rgba(212, 149, 106, 0.4);
}

/* Threshold flicker — when crossing the threshold */
.threshold-dot.threshold-flicker {
  animation: dotFlicker 0.6s steps(1) forwards;
}

/* Focus Keyword Field */
.seo-field {
  margin-bottom: 18px;
}
.seo-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #58a6ff;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}
.seo-field input {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 10px 12px;
  color: #e6edf3;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.seo-field input:focus {
  border-color: #58a6ff;
}
.seo-field input::placeholder {
  color: #484f58;
}

/* Focus Keyword LED header */
.seo-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.seo-field-header label {
  margin-bottom: 0;
}
.focus-led {
  display: flex;
  align-items: center;
  gap: 8px;
}
.focus-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f85149;
  box-shadow: 0 0 8px rgba(248, 81, 73, 0.5);
  display: inline-block;
  animation: redPulse 3s ease-in-out infinite;
}
@keyframes redPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(248, 81, 73, 0.3); background: #d43a35; }
  50% { box-shadow: 0 0 16px rgba(248, 81, 73, 0.8), 0 0 28px rgba(248, 81, 73, 0.25); background: #f85149; }
}
.focus-text {
  color: #d4956a;
  text-shadow: 0 0 10px rgba(212, 149, 106, 0.4);
  transition: color 0.4s, text-shadow 0.4s;
}

/* Focus keyword active — green dot, dim text */
.focus-led.active .focus-dot {
  background: #3fb950;
  box-shadow: 0 0 10px rgba(63, 185, 80, 0.6);
  animation: dotPulse 3s ease-in-out infinite;
}
.focus-led.active .focus-text {
  color: #2a2a2a;
  text-shadow: none;
}

/* Focus dot flicker (red→green or green→red) */
.focus-dot.focus-flicker-on {
  animation: focusFlickerOn 0.6s steps(1) forwards;
}
@keyframes focusFlickerOn {
  0%   { background: #f85149; box-shadow: 0 0 8px rgba(248, 81, 73, 0.5); }
  20%  { background: #3fb950; box-shadow: 0 0 8px rgba(63, 185, 80, 0.6); }
  35%  { background: #2a2a2a; box-shadow: none; }
  55%  { background: #3fb950; box-shadow: 0 0 12px rgba(63, 185, 80, 0.7); }
  70%  { background: #1a3a1a; box-shadow: none; }
  100% { background: #3fb950; box-shadow: 0 0 10px rgba(63, 185, 80, 0.8); }
}
.focus-dot.focus-flicker-off {
  animation: focusFlickerOff 0.6s steps(1) forwards;
}
@keyframes focusFlickerOff {
  0%   { background: #3fb950; box-shadow: 0 0 10px rgba(63, 185, 80, 0.6); }
  20%  { background: #f85149; box-shadow: 0 0 8px rgba(248, 81, 73, 0.5); }
  35%  { background: #2a2a2a; box-shadow: none; }
  55%  { background: #f85149; box-shadow: 0 0 12px rgba(248, 81, 73, 0.7); }
  70%  { background: #1a3a1a; box-shadow: none; }
  100% { background: #f85149; box-shadow: 0 0 8px rgba(248, 81, 73, 0.5); }
}

/* SEO Check Rows */
.seo-checks {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.seo-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #21262d;
  font-size: 0.82rem;
  color: #8b949e;
  transition: color 0.2s;
}
.seo-check:last-child {
  border-bottom: none;
}
.seo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f85149;
  box-shadow: 0 0 6px rgba(248, 81, 73, 0.4);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.seo-check.pass .seo-dot {
  background: #3fb950;
  box-shadow: 0 0 6px rgba(63, 185, 80, 0.4);
}
.seo-check.warn .seo-dot {
  background: #d29922;
  box-shadow: 0 0 6px rgba(210, 153, 34, 0.4);
}
.seo-check.warn-glow .seo-dot {
  background: #d29922;
  box-shadow: 0 0 8px rgba(210, 153, 34, 0.6);
  animation: yellowPulse 3s ease-in-out infinite;
}
@keyframes yellowPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(210, 153, 34, 0.3); background: #b8851d; }
  50% { box-shadow: 0 0 14px rgba(210, 153, 34, 0.8), 0 0 24px rgba(210, 153, 34, 0.25); background: #d29922; }
}
.seo-check.fail .seo-dot {
  background: #f85149;
  box-shadow: 0 0 6px rgba(248, 81, 73, 0.4);
}
.seo-check.pass { color: #adbac7; }
.seo-check.warn { color: #adbac7; }
.seo-check.warn-glow { color: #adbac7; }
.seo-check.fail { color: #adbac7; }
.seo-check-label {
  flex: 1;
}
.seo-check-meta {
  font-size: 0.72rem;
  color: #6e7681;
  font-weight: 600;
  white-space: nowrap;
}

/* Tip */
.seo-tip {
  margin-top: 16px;
  font-size: 0.78rem;
  color: #6e7681;
  font-style: italic;
  line-height: 1.5;
}

/* ============================================
   PUBLISH CONFIRMATION MODAL
============================================ */
.confirm-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 28px 28px 24px;
  max-width: 480px;
  width: 92%;
  border-top: 3px solid #58a6ff;
}
.confirm-title {
  color: #e6edf3;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
}
.confirm-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.confirm-row {
  display: flex;
  gap: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
}
.confirm-label {
  color: #8b949e;
  font-weight: 600;
  min-width: 100px;
  flex-shrink: 0;
}
.confirm-value {
  color: #e6edf3;
  word-break: break-word;
}
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.confirm-btn {
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.confirm-btn:active {
  transform: scale(0.97);
}
.confirm-btn-back {
  background: #da3633;
  color: #fff;
}
.confirm-btn-back:hover {
  background: #e5534b;
}
.confirm-btn-go {
  background: #2ea043;
  color: #fff;
}
.confirm-btn-go:hover {
  background: #36b34d;
}

/* ============================================
   SESSION TIMEOUT & DRAFT RECOVERY
============================================ */
.session-expired-msg {
  background: #1c1208;
  border: 1px solid #5d4a00;
  color: #d4a017;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 16px;
}

.draft-recovery-banner {
  background: #0d2818;
  border: 1px solid #238636;
  border-radius: 10px;
  padding: 14px 20px;
  margin: 0 1.5rem 20px;
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
}
.draft-recovery-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.draft-recovery-icon {
  font-size: 1.2rem;
}
.draft-recovery-text {
  flex: 1;
  color: #adbac7;
  font-size: 0.88rem;
  min-width: 200px;
}
.draft-recovery-text strong {
  color: #e6edf3;
}
.draft-recovery-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.draft-recovery-btn:hover {
  opacity: 0.85;
}
.draft-recovery-restore {
  background: #238636;
  color: #fff;
}
.draft-recovery-dismiss {
  background: #30363d;
  color: #8b949e;
}

/* ============================================
   CONTENT BREADCRUMB (Site > Category > Title)
============================================ */
.content-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 0.85rem;
  font-weight: 600;
}
.crumb {
  transition: color 0.3s, text-shadow 0.3s;
}
.crumb-sep {
  color: #30363d;
  font-size: 1rem;
  font-weight: 400;
  user-select: none;
}

/* Site name — always shows, neutral */
.crumb-site {
  color: #8b949e;
}

/* Missing state — red with glow */
.crumb.missing {
  color: #f85149;
  text-shadow: 0 0 8px rgba(248, 81, 73, 0.4);
}

/* Complete state — green with glow */
.crumb.complete {
  color: #2ea043;
  text-shadow: 0 0 8px rgba(46, 160, 67, 0.35);
}

/* ============================================
   SCHEMA / CANONICAL INDICATOR LIGHTS
============================================ */
.seo-indicators {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 8px;
}
.seo-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #8b949e;
  letter-spacing: 0.3px;
  transition: color 0.3s;
}
.indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f85149;
  box-shadow: 0 0 6px rgba(248, 81, 73, 0.4);
  flex-shrink: 0;
  transition: background 0.4s, box-shadow 0.4s;
}
.seo-indicator.ready .indicator-dot {
  background: #2ea043;
  box-shadow: 0 0 8px rgba(46, 160, 67, 0.5);
}
.seo-indicator.ready {
  color: #adbac7;
}
