/* ============================================
   SEOMaster — Commercial-Grade Theme
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #7c3aed;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

body {
  background-color: var(--gray-50);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--gray-700);
}

/* ---- Navbar ---- */
.navbar {
  background: linear-gradient(135deg, var(--gray-900) 0%, #1e293b 100%) !important;
  box-shadow: var(--shadow-md);
  padding: 0.6rem 0;
}
.navbar-brand {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.5px;
}
.navbar-brand i {
  color: var(--primary);
}
.navbar .nav-link {
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: 6px;
  transition: all 0.2s;
  margin: 0 2px;
}
.navbar .nav-link:hover {
  background: rgba(255,255,255,0.1);
}
.navbar .nav-link.active {
  background: var(--primary) !important;
  color: #fff !important;
}
.badge.bg-warning {
  font-size: 0.7rem;
}

/* ---- Cards ---- */
.card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  padding: 0.75rem 1rem;
}

/* ---- Stat Cards (Dashboard) ---- */
.stat-card {
  border: none;
  border-radius: var(--radius);
  color: #fff;
  overflow: hidden;
  position: relative;
}
.stat-card .card-body {
  position: relative;
  z-index: 1;
  padding: 1.25rem;
}
.stat-card .stat-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  opacity: 0.2;
  z-index: 0;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-top: 4px;
}
.stat-card.bg-gradient-blue {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
}
.stat-card.bg-gradient-green {
  background: linear-gradient(135deg, #059669, #10b981);
}
.stat-card.bg-gradient-purple {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}
.stat-card.bg-gradient-orange {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

/* ---- Buttons ---- */
.btn {
  border-radius: 8px;
  font-weight: 500;
  padding: 0.45rem 1rem;
  transition: all 0.2s;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-success {
  background: var(--success);
  border-color: var(--success);
}
.btn-lg {
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
}

/* ---- Tables ---- */
.table {
  border-radius: var(--radius);
  overflow: hidden;
}
.table thead th {
  background: var(--gray-100);
  border-bottom: 2px solid var(--gray-200);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  padding: 0.75rem 1rem;
}
.table tbody tr {
  transition: background 0.15s;
}
.table tbody tr:hover {
  background: var(--primary-light);
}
.table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(0,0,0,0.015);
}

/* ---- Badges ---- */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
  border-radius: 6px;
  font-size: 0.8rem;
}
.badge.bg-success { background: var(--success) !important; }
.badge.bg-danger { background: var(--danger) !important; }
.badge.bg-warning { background: var(--warning) !important; color: #fff !important; }
.badge.bg-secondary { background: var(--gray-500) !important; }
.badge.bg-primary { background: var(--primary) !important; }
.badge.bg-info { background: #0891b2 !important; }

/* ---- Forms ---- */
.form-control, .form-select {
  border-radius: 8px;
  border: 1px solid var(--gray-300);
  padding: 0.5rem 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}
.form-text {
  color: var(--gray-500);
  font-size: 0.8rem;
}
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* ---- List Groups ---- */
.list-group-item {
  border-color: var(--gray-200);
  transition: background 0.15s;
}
.list-group-item:hover {
  background: var(--gray-50);
}
.list-group-item-action:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ---- Alerts ---- */
.alert {
  border-radius: var(--radius);
  border: none;
}

/* ---- Progress Bar ---- */
.progress {
  border-radius: 12px;
  background: var(--gray-200);
  overflow: hidden;
}
.progress-bar {
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.8rem;
}

/* ---- Spinning animation ---- */
.spinning {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---- Article Preview ---- */
.article-preview {
  line-height: 1.9;
  font-size: 1rem;
  color: #333;
}
.article-preview h1 {
  font-size: 1.8rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: #1a1a1a;
}
.article-preview h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--gray-200);
  font-weight: 600;
  color: #2c3e50;
}
.article-preview h3 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  font-weight: 600;
  color: #34495e;
}
.article-preview h4 {
  font-size: 1.1rem;
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #444;
}
.article-preview p {
  margin-bottom: 1rem;
}
.article-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}
.article-preview blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  margin: 1.5rem 0;
  background: var(--gray-50);
  border-radius: 0 8px 8px 0;
  color: #555;
}
.article-preview ul, .article-preview ol {
  padding-left: 24px;
  margin-bottom: 1rem;
}

.dashboard-hero,
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-kicker {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.dashboard-title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.1;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
  font-weight: 800;
}

.dashboard-subtitle {
  max-width: 680px;
  color: var(--gray-500);
  margin-bottom: 0;
}

.dashboard-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.metric-card {
  border: 1px solid var(--gray-200);
}

.metric-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  margin-bottom: 0.45rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
}

.empty-state {
  text-align: center;
}

.empty-state i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 0.8rem;
  display: inline-block;
}

.empty-state h3 {
  font-size: 1.25rem;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--gray-500);
  max-width: 520px;
  margin: 0 auto 1rem;
}

.quality-list {
  display: grid;
  gap: 10px;
}

.quality-list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}

.project-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
}

.project-pill-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.project-switcher {
  min-width: 160px;
}

.batch-grid {
  display: grid;
  gap: 20px;
}

.batch-task-card {
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow-sm);
}

.batch-task-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.batch-task-eyebrow {
  color: var(--primary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.batch-task-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.scene-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.scene-chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.batch-status-list {
  display: grid;
  gap: 12px;
}

.batch-status-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: #fff;
}

.detail-shell {
  display: block;
}

.detail-shell-focused .detail-hero {
  margin-bottom: 1.5rem;
}

.detail-hero-main {
  max-width: 760px;
}

.detail-hero {
  background: linear-gradient(135deg, #ffffff 0%, #eef5ff 100%);
  box-shadow: var(--shadow-md);
}

.detail-eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.detail-title {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  color: var(--gray-900);
  font-weight: 800;
}

.detail-panel {
  border-radius: 16px;
}

.detail-inline-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.detail-inline-item {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--gray-200);
  background: rgba(255,255,255,0.72);
}

.detail-inline-label {
  display: block;
  font-size: 0.76rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.quality-stat {
  border-radius: 16px;
  padding: 22px;
  min-height: 140px;
  box-shadow: var(--shadow);
  background: #fff;
  border: 1px solid var(--gray-200);
}

.quality-stat.is-good {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.quality-stat.is-pending {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
}

.quality-stat-label {
  color: var(--gray-500);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.55rem;
}

.quality-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gray-900);
}

.config-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-200);
}

.config-row:last-child {
  border-bottom: none;
}

.outline-block {
  height: 100%;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  background: #fff;
  padding: 16px;
}

.detail-sticky-stack {
  position: sticky;
  top: 88px;
  z-index: 1;
}

.detail-outline-card {
  max-height: calc(100vh - 108px);
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.detail-outline-header {
  position: sticky;
  top: 0;
  z-index: 2;
}

.detail-outline-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}

.detail-outline-body::-webkit-scrollbar {
  width: 8px;
}

.detail-outline-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 999px;
}

.detail-outline-body::-webkit-scrollbar-track {
  background: transparent;
}

.flow-shell .col-xl-4 {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.flow-shell .col-xl-4 > .card,
.flow-shell .col-xl-4 > .detail-sticky-stack {
  margin-bottom: 0 !important;
}

.outline-list {
  display: grid;
  gap: 10px;
}

.outline-tree {
  display: grid;
  gap: 14px;
}

.outline-tree-section {
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.outline-tree-h2,
.outline-tree-h3 {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.outline-tree-h2 {
  font-weight: 700;
  color: var(--gray-900);
}

.outline-tree-h3 {
  color: var(--gray-700);
  font-size: 0.92rem;
}

.outline-tree-h2:hover,
.outline-tree-h3:hover {
  color: var(--primary);
}

.outline-tree-h2.is-active,
.outline-tree-h3.is-active {
  color: var(--primary);
}

.outline-tree-h2.is-active .outline-tree-text,
.outline-tree-h3.is-active .outline-tree-text {
  font-weight: 700;
}

.outline-tree-h2.is-active .outline-tree-badge,
.outline-tree-h3.is-active .outline-tree-badge {
  background: var(--primary);
  color: #fff;
}

.outline-tree-children {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-left: 10px;
  border-left: 2px solid var(--gray-200);
}

.outline-tree-badge {
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.outline-tree-badge-sub {
  background: var(--gray-100);
  color: var(--gray-700);
}

.outline-tree-text {
  line-height: 1.6;
}

.outline-list-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: #fff;
}

.outline-list-index {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.outline-list-content {
  min-width: 0;
}

.outline-list-meta {
  color: var(--gray-500);
  font-size: 0.82rem;
  white-space: nowrap;
  padding-top: 0.15rem;
}

.detail-thesis {
  line-height: 1.7;
}

.detail-compact-panel .card-body {
  padding-top: 0.75rem;
}

.detail-failure-list {
  margin-top: 16px;
}

.detail-content-card {
  min-height: 78vh;
}

.detail-content-body {
  padding: 28px 30px;
}

.article-preview-focused {
  max-width: 820px;
  margin: 0 auto;
}

.outline-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.concept-preview {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.7;
  background: var(--gray-50);
  border-radius: 12px;
  padding: 14px;
  margin: 0;
}

.image-placeholder {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border-radius: 14px;
  border: 1px dashed var(--gray-300);
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  color: var(--gray-700);
  margin: 1.5rem 0;
  text-align: center;
  padding: 20px;
}

.image-placeholder i {
  font-size: 2rem;
  color: var(--primary);
}

.image-placeholder small {
  color: var(--gray-500);
}

.image-placeholder-failed {
  border-style: solid;
  background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%);
}

@media (max-width: 991px) {
  .dashboard-actions,
  .page-header {
    width: 100%;
  }

  .project-pill {
    width: 100%;
    justify-content: center;
  }

  .detail-inline-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-sticky-stack {
    position: static;
  }

  .detail-content-card {
    min-height: auto;
  }

  .detail-content-body {
    padding: 20px;
  }
}

@media (max-width: 575px) {
  .detail-inline-summary {
    grid-template-columns: 1fr;
  }
}
.article-preview li {
  margin-bottom: 0.4rem;
}
.article-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
.article-preview th, .article-preview td {
  border: 1px solid var(--gray-200);
  padding: 10px 14px;
}
.article-preview th {
  background-color: var(--gray-100);
  font-weight: 600;
}
.article-preview a {
  color: var(--primary);
  text-decoration: none;
}
.article-preview a:hover {
  text-decoration: underline;
}
.article-preview code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
  color: #d63384;
}
.article-preview pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
}
.article-preview pre code {
  background: none;
  color: inherit;
  padding: 0;
}
.article-preview hr {
  margin: 2rem 0;
  border-color: var(--gray-200);
}

.article-preview h2,
.article-preview h3 {
  scroll-margin-top: 110px;
}

.article-preview h2.is-outline-target,
.article-preview h3.is-outline-target {
  animation: outlineTargetPulse 1.2s ease;
}

@keyframes outlineTargetPulse {
  0% {
    background: rgba(37, 99, 235, 0.16);
  }
  100% {
    background: transparent;
  }
}

/* Image placeholder */
.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  margin: 1.5rem 0;
  background: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-500);
  text-align: center;
}
.image-placeholder i {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--gray-300);
}
.image-placeholder span {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}
.image-placeholder small {
  font-size: 0.8rem;
  color: var(--gray-300);
}

/* ---- TOC sidebar ---- */
#toc a {
  color: var(--gray-500);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
#toc a:hover {
  color: var(--primary);
  background-color: var(--primary-light);
  border-left-color: var(--primary);
}

/* ---- Quick Actions Card ---- */
.quick-actions .list-group-item-action {
  padding: 0.75rem 1rem;
  font-weight: 500;
}
.quick-actions .list-group-item-action i {
  color: var(--primary);
  margin-right: 8px;
  width: 20px;
  text-align: center;
}

/* ---- Search Bar ---- */
.search-bar {
  background: #fff;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.search-bar .form-control {
  border-right: none;
}
.search-bar .input-group-text {
  background: #fff;
  border-left: none;
  color: var(--gray-500);
}

/* ---- Empty State ---- */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--gray-500);
}
.empty-state i {
  font-size: 4rem;
  color: var(--gray-300);
  margin-bottom: 1rem;
}
.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

/* ---- Step Timeline ---- */
.step-timeline {
  position: relative;
  padding-left: 0;
}
.step-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 0;
  position: relative;
}
.step-item + .step-item {
  border-top: 1px solid var(--gray-200);
}
.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
  margin-right: 12px;
  transition: all 0.3s;
}
.step-item.active .step-number {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}
.step-item.done .step-number {
  background: var(--success);
  color: white;
}
.step-item.done .step-number::after {
  content: '\2713';
}
.step-item.done .step-number {
  font-size: 0;
}
.step-item.done .step-number::after {
  font-size: 16px;
}
.step-content {
  flex: 1;
}
.step-title {
  font-weight: 600;
  margin-bottom: 2px;
}
.step-item.active .step-title {
  color: var(--primary);
}
.step-item.done .step-title {
  color: var(--success);
}

/* ---- Project Selector ---- */
.project-selector {
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 4px 12px;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  font-size: 0.85rem;
}
.project-selector:focus {
  outline: none;
  border-color: var(--primary);
}
.project-selector option {
  color: #333;
  background: #fff;
}

/* ---- Chart Container ---- */
.chart-container {
  position: relative;
  height: 200px;
  width: 100%;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.page-header h4 {
  margin: 0;
  font-weight: 700;
  color: var(--gray-900);
}

/* ---- Article Workbench ---- */
.article-card {
  border: 1px solid var(--gray-200);
}
.article-card .article-title {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--gray-900);
}
.article-card-metrics {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
}
.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}
.metric-label {
  color: var(--gray-500);
}
.metric-value {
  color: var(--gray-900);
  font-weight: 600;
  text-align: right;
}
.article-card-footer .btn {
  min-width: 88px;
}

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}
.login-card .brand {
  text-align: center;
  margin-bottom: 2rem;
}
.login-card .brand i {
  font-size: 2.5rem;
  color: var(--primary);
}
.login-card .brand h2 {
  font-weight: 700;
  color: var(--gray-900);
  margin-top: 0.5rem;
}
.login-card .brand p {
  color: var(--gray-500);
  font-size: 0.9rem;
}
.login-card .input-icon-wrapper {
  position: relative;
}
.login-card .input-icon-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
}
.login-card .input-icon-wrapper .form-control {
  padding-left: 2.5rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .container-fluid {
    padding: 0.5rem;
  }
  .page-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  .stat-card .stat-value {
    font-size: 1.5rem;
  }
}

/* ---- Article Flow Wizard ---- */
.wizard-shell,
.flow-shell {
  display: grid;
  gap: 0;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.wizard-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  background: #fff;
}

.wizard-step-active {
  border-color: var(--primary);
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  box-shadow: var(--shadow-md);
}

.wizard-step-index,
.flow-step-index {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.wizard-step-title,
.flow-step-title,
.wizard-section-title {
  font-weight: 700;
  color: var(--gray-900);
}

.wizard-step-desc,
.flow-step-desc,
.wizard-summary-item .text-muted {
  font-size: 0.88rem;
}

.wizard-card,
.flow-header,
.flow-steps {
  box-shadow: var(--shadow-md);
}

.wizard-project-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}

.wizard-section-title {
  margin-bottom: 14px;
  font-size: 1rem;
}

.wizard-summary-item + .wizard-summary-item {
  margin-top: 16px;
}

.flow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--gray-500);
  font-size: 0.9rem;
}

.flow-stepper {
  display: grid;
  gap: 12px;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: #fff;
}

.flow-step-content {
  flex: 1;
}

.flow-step-done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.flow-step-active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.flow-step-pending {
  opacity: 0.78;
}

.flow-step-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.quality-report-panel {
  padding: 18px;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.quality-report-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.quality-report-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.quality-report-block + .quality-report-block {
  margin-top: 14px;
}

.quality-report-subtitle {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.quality-report-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--gray-700);
}

.quality-report-list li + li {
  margin-top: 6px;
}

.quality-report-details {
  margin-top: 14px;
}

.quality-report-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
}

.quality-report-raw {
  margin-top: 10px;
  padding: 14px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.84rem;
  line-height: 1.6;
}

.config-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-200);
}

.config-row:last-child {
  border-bottom: 0;
}

.outline-block {
  padding: 14px;
  border-radius: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}

.outline-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}

@media (max-width: 991px) {
  .wizard-steps {
    grid-template-columns: 1fr;
  }
}

/* ===== UX Improvements: Progress Bar, Step Detail Card, Error Card ===== */

/* 4-step horizontal bar */
.step-bar {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  margin-bottom: 16px;
}
.step-bar-item {
  flex: 1;
  padding: 8px 6px;
  text-align: center;
  border-right: 1px solid #e2e8f0;
  background: #f8f9fa;
  transition: background 0.2s;
}
.step-bar-item:last-child { border-right: none; }
.step-bar-item.is-done { background: #dcfce7; }
.step-bar-item.is-active { background: #eff6ff; border-top: 3px solid #2563eb; }
.step-bar-item.is-error { background: #fef2f2; border-top: 3px solid #dc2626; }
.step-bar-item.is-pending { opacity: 0.5; }
.step-bar-status {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 2px;
}
.step-bar-item.is-done .step-bar-status { color: #16a34a; }
.step-bar-item.is-active .step-bar-status { color: #2563eb; }
.step-bar-item.is-error .step-bar-status { color: #dc2626; }
.step-bar-item.is-pending .step-bar-status { color: #94a3b8; }
.step-bar-name { font-size: 12px; font-weight: 600; }
.step-bar-sub { font-size: 10px; color: #888; margin-top: 1px; }

/* Step detail card */
.step-detail-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.step-detail-ring-wrap {
  flex-shrink: 0;
  text-align: center;
}
.step-detail-ring {
  position: relative;
  width: 72px;
  height: 72px;
}
.step-detail-ring svg {
  width: 72px;
  height: 72px;
  transform: rotate(-90deg);
}
.step-detail-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 15px;
  font-weight: 700;
  color: #2563eb;
}
.step-detail-ring-label {
  font-size: 11px;
  color: #64748b;
  margin-top: 6px;
}
.step-detail-body { flex: 1; min-width: 0; }
.step-detail-title {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
  margin-bottom: 10px;
}

/* Sub-task list */
.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  margin-bottom: 10px;
}
.subtask-done { color: #16a34a; }
.subtask-active { color: #2563eb; font-weight: 600; }
.subtask-pending { color: #94a3b8; }
.subtask-elapsed {
  font-weight: 400;
  color: #94a3b8;
  font-size: 11px;
  margin-left: 4px;
}

/* Progress bar inside detail card */
.step-detail-progress-bar {
  height: 4px;
  background: #dbeafe;
  border-radius: 2px;
  overflow: hidden;
}
.step-detail-progress-fill {
  height: 4px;
  background: #2563eb;
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Error card */
.error-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.error-icon { font-size: 2rem; flex-shrink: 0; }
.error-body { flex: 1; min-width: 0; }
.error-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.error-reason { font-size: 13px; color: #555; margin-bottom: 6px; }
.error-suggestion {
  font-size: 13px;
  background: #fef9c3;
  border-left: 3px solid #f59e0b;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.error-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.error-card.type-timeout .error-title { color: #b45309; }
.error-card.type-api_error .error-title { color: #7c3aed; }
.error-card.type-auth .error-title { color: #dc2626; }
.error-card.type-network .error-title { color: #0369a1; }
.error-card.type-content .error-title { color: #374151; }
.error-card.type-unknown .error-title { color: #374151; }
.error-raw-details { margin-top: 8px; font-size: 12px; }
.error-raw-details summary { cursor: pointer; color: #6b7280; }
.error-raw-details pre {
  background: #f3f4f6;
  border-radius: 4px;
  padding: 10px;
  font-size: 11px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 6px;
}

/* ---- Bulk publish ---- */
.col-check { width: 36px; }

.bulk-mode-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #e7f1ff;
  border: 1px solid #b8d4fe;
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 12px;
}

.publish-progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}
.publish-progress-item:last-child { border-bottom: none; }

.status-icon { width: 20px; text-align: center; }
