:root {
  --bg: #f1f3f6;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #64748b;
  --line: #cfd7e3;
  --line-dark: #9aa4b2;
  --primary: #3d5afe;
  --primary-dark: #2444e8;
  --soft: #eef3ff;
  --warning: #fff8e6;
  --warning-line: #f1b400;
  --success: #138a5b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, "Segoe UI", Tahoma, sans-serif;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 180px;
  background: #0f0f10;
  color: #fff;
  padding: 14px 0;
}

.sidebar-brand {
  padding: 0 14px 14px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.app-sidebar nav {
  display: grid;
  gap: 2px;
}

.app-sidebar a,
.menu-label {
  display: flex;
  min-height: 36px;
  align-items: center;
  padding: 0 14px;
  color: #c9c9d1;
  font-size: 14px;
  text-decoration: none;
}

.app-sidebar a.active {
  color: #fff;
  background: #3d5afe;
  font-weight: 800;
}

.app-sidebar a.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.menu-label {
  min-height: 28px;
  margin-top: 8px;
  color: #fff;
  font-weight: 800;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 180px));
  margin-left: 180px;
  padding: 18px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  padding: 18px 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

p,
.help-text,
label,
td,
li {
  color: var(--muted);
}

.header-actions a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border-radius: 4px;
  color: var(--primary);
  background: var(--soft);
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(560px, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
  align-items: start;
}

.builder-card,
.preview-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}

.builder-card {
  padding: 22px 24px 28px;
}

.preview-card {
  position: sticky;
  top: 18px;
  min-height: calc(100vh - 36px);
  overflow: hidden;
}

.step-heading {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.keyword-import {
  border: 1px solid var(--warning-line);
  border-radius: 4px;
  background: var(--warning);
  padding: 16px;
  margin-bottom: 26px;
}

.keyword-import label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-weight: 700;
}

.import-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.excel-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.excel-upload input {
  background: #fff;
}

.excel-upload span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.field-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.field-row.wide {
  align-items: start;
}

.field-row.compact > select,
.field-row.compact > div {
  max-width: 360px;
}

label {
  color: var(--ink);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  color: var(--ink);
  background: #fff;
  padding: 9px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(61, 90, 254, 0.12);
}

.help-text {
  margin-top: 6px;
  font-size: 13px;
}

.checkbox-row {
  align-items: start;
}

.check-label {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-weight: 400;
}

.check-label input {
  width: 16px;
  min-height: 16px;
  flex: 0 0 16px;
}

.settings-box {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  padding: 20px 22px;
  margin-top: 26px;
}

.settings-box h2 {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
}

.primary-btn,
.secondary-btn,
.toolbar-actions button,
.import-row button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-btn {
  min-width: 220px;
  color: #fff;
  background: var(--primary);
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn,
.toolbar-actions button,
.import-row button {
  color: var(--primary);
  background: var(--soft);
}

.toolbar-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.edit-field,
.edit-textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  background: #fff;
  padding: 9px 10px;
}

.edit-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.7;
}

.editable-block {
  display: grid;
  gap: 10px;
}

.editable-block label {
  color: var(--muted);
  font-size: 13px;
}

.classic-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}

.classic-main {
  min-width: 0;
}

.classic-title {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  border: 1px solid var(--line-dark);
  background: #fff;
  padding: 8px 10px;
  font-size: 20px;
  font-weight: 700;
}

.permalink-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.permalink-row input {
  max-width: 360px;
  min-height: 30px;
  padding: 5px 8px;
}

.editor-top-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.editor-top-actions button,
.classic-toolbar button,
.classic-toolbar select {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 700;
}

.editor-tabs {
  display: flex;
  gap: 6px;
}

.editor-tabs button.active {
  background: var(--soft);
  color: var(--primary);
}

.classic-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #f8fafc;
  padding: 6px;
}

.classic-toolbar select {
  min-width: 140px;
}

.wp-editor-area {
  min-height: 640px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 20px;
  line-height: 1.8;
  outline: none;
}

.wp-editor-area h2 {
  margin: 26px 0 10px;
  font-size: 24px;
}

.wp-editor-area p {
  margin: 0 0 12px;
  color: var(--ink);
}

.yoast-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.yoast-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.yoast-head h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.yoast-head p {
  color: var(--muted);
  font-size: 13px;
}

.yoast-score {
  display: inline-flex;
  min-width: 108px;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
}

.yoast-score.good,
.yoast-analysis .good {
  color: #118a37;
}

.yoast-score.ok,
.yoast-analysis .ok {
  color: #a16207;
}

.yoast-score.bad,
.yoast-analysis .bad {
  color: #b42318;
}

.yoast-score.good {
  background: #dcfce7;
}

.yoast-score.ok {
  background: #fef3c7;
}

.yoast-score.bad {
  background: #fee2e2;
}

.yoast-focus,
.search-appearance,
.yoast-fields,
.yoast-analysis {
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.yoast-focus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.yoast-focus label,
.yoast-fields label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
}

.yoast-focus input,
.yoast-fields input,
.yoast-fields textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  padding: 9px 10px;
  font: inherit;
  font-weight: 600;
}

.yoast-focus button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary);
  padding: 0 12px;
  font-weight: 800;
}

.search-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.device-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.toggle-dot {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #b91c78;
  position: relative;
}

.toggle-dot::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
}

.google-preview {
  max-width: 390px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  padding: 14px;
}

.preview-site {
  color: #111827;
  font-size: 12px;
  font-weight: 800;
}

.preview-title {
  margin-top: 8px;
  color: #1a0dab;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
}

.preview-url {
  margin-top: 4px;
  color: #047857;
  font-size: 12px;
}

.google-preview p {
  margin-top: 8px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.45;
}

.yoast-fields {
  display: grid;
  gap: 14px;
}

.yoast-bar {
  display: block;
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
}

.yoast-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #7ac70c;
}

.yoast-fields small {
  color: var(--muted);
  font-weight: 600;
}

.yoast-analysis {
  border-bottom: 0;
}

.yoast-analysis summary {
  cursor: pointer;
  font-weight: 900;
}

.yoast-analysis summary strong {
  margin-left: 8px;
}

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

.analysis-grid ul {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.analysis-grid li span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.classic-side {
  display: grid;
  align-content: start;
  gap: 12px;
}

.side-box {
  border: 1px solid var(--line);
  background: #fff;
}

.side-box h3 {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 14px;
}

.side-box-content {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.side-box label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.side-box input,
.side-box textarea,
.side-box select {
  width: 100%;
  border: 1px solid var(--line-dark);
  padding: 8px;
}

.featured-placeholder {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-dark);
  background: #f8fafc;
  color: var(--muted);
  padding: 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

.publish-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.update-btn {
  color: #fff;
  background: var(--primary) !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(16, 24, 40, 0.35);
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  display: grid;
  width: min(460px, 100%);
  gap: 14px;
  border-radius: 4px;
  background: #fff;
  padding: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  padding: 16px 20px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state {
  display: grid;
  min-height: 420px;
  place-content: center;
  gap: 8px;
  padding: 30px;
  text-align: center;
}

.empty-state h3 {
  font-size: 24px;
}

.article-output {
  padding: 22px;
}

.hidden {
  display: none;
}

.seo-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfdff;
  padding: 12px;
}

.metric span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  line-height: 1.45;
}

.content-block {
  border-top: 1px solid #e5e7eb;
  padding: 20px 0;
}

.content-block h3 {
  margin-bottom: 12px;
}

.content-block h4 {
  margin: 16px 0 6px;
}

.content-block p,
.content-block li {
  line-height: 1.7;
}

.content-block ul,
.content-block ol {
  margin: 0;
  padding-left: 22px;
}

.article-body h2 {
  margin: 22px 0 8px;
  font-size: 22px;
}

.article-body h2:first-child {
  margin-top: 0;
}

.pill-list,
.research-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill,
.research-links a {
  display: inline-flex;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--soft);
  padding: 8px 11px;
  font-weight: 700;
  text-decoration: none;
}

.inline-search {
  margin-left: 8px;
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.checklist li.done {
  color: var(--success);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  border-radius: 4px;
  color: white;
  background: var(--ink);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }

  .classic-editor {
    grid-template-columns: 1fr;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .preview-card {
    position: static;
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  .app-sidebar {
    position: static;
    width: 100%;
  }

  .app-sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    width: 100%;
    margin-left: 0;
    padding: 10px;
  }

  .app-header,
  .preview-toolbar {
    display: grid;
  }

  .field-row,
  .excel-upload,
  .import-row,
  .seo-summary {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .toolbar-actions {
    display: grid;
  }

  .primary-btn,
  .secondary-btn,
  .toolbar-actions button {
    width: 100%;
  }
}
