/* Article Idea Generator Pro — premium dashboard */

:root {
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.08), 0 16px 40px rgba(15, 23, 42, 0.1);
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --emerald: #059669;
  --amber: #d97706;
  --rose: #e11d48;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #64748b;
  --accent: linear-gradient(135deg, #4f46e5 0%, #0d9488 100%);
  --ring: rgba(79, 70, 229, 0.35);
}

body.dark {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #0f172a;
  --border: rgba(148, 163, 184, 0.12);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.5);
  --ring: rgba(129, 140, 248, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.2s ease;
}

body.dark {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(79, 70, 229, 0.18), transparent),
    radial-gradient(800px 400px at 100% 0%, rgba(13, 148, 136, 0.12), transparent), var(--bg);
}

.wrapper {
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px 20px 32px;
}

.guy {
  position: relative;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.chip-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.chip-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.install-btn.install-btn--pending {
  border-style: dashed;
}

.secondary-btn {
  background: var(--surface-2);
}

.btn-icon {
  font-size: 15px;
  line-height: 1;
}

.app-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.sidebar-left,
.sidebar-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 16px;
}

.brand-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.group {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.side-box {
  margin-bottom: 12px;
}

.side-box:last-child {
  margin-bottom: 0;
}

.side-box label,
.label-row {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.hint {
  font-weight: 500;
  opacity: 0.85;
  font-size: 11px;
}

.side-box--row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.cluster-toggle-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.switch-label {
  font-size: 11px;
  color: var(--muted);
}

input[type="text"],
input[type="search"],
input[type="number"],
select.input-select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--ring);
}

body.dark input,
body.dark select,
body.dark textarea {
  background: #0f172a;
  border-color: var(--border);
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.cat-toggle:hover {
  background: rgba(79, 70, 229, 0.06);
}

body.dark .cat-toggle:hover {
  background: rgba(129, 140, 248, 0.08);
}

.cat-toggle input {
  accent-color: var(--indigo);
}

.full {
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background: rgba(79, 70, 229, 0.1);
  color: var(--indigo-dark);
  border-color: rgba(79, 70, 229, 0.25);
}

body.dark .btn-secondary {
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(129, 140, 248, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.04);
}

body.dark .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-toolbar {
  padding: 8px 12px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

body.dark .btn-toolbar {
  background: #0f172a;
}

.btn.sm {
  font-size: 12px;
  padding: 8px 10px;
}

.btn-icon {
  min-width: 40px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.row-inputs {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.row-inputs .input-select {
  flex: 1;
}

.row-actions {
  margin-top: 4px;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.tool-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.title-block {
  min-width: 0;
}

.tool-title {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #4f46e5, #0d9488);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.dark .tool-title {
  background: linear-gradient(90deg, #a5b4fc, #5eead4);
  -webkit-background-clip: text;
  background-clip: text;
}

.tool-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch--sm {
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  transition: 0.25s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch--sm .slider:before {
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
}

.switch--sm input:checked + .slider:before {
  transform: translateX(16px);
}

input:checked + .slider {
  background: var(--indigo);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 24px;
}

.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.cluster-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.35s ease;
}

.cluster-panel.hidden {
  display: none;
}

.cluster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cluster-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.cluster-pillar {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(13, 148, 136, 0.08));
  border: 1px solid var(--border);
}

.cluster-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cluster-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.cluster-list li:last-child {
  border-bottom: none;
}

.cluster-map {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--muted);
  background: var(--surface-2);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.ideas-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-height: 200px;
}

.ideas-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ideas-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ideas-meta {
  font-size: 12px;
  color: var(--muted);
}

.idea-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: min(62vh, 720px);
  overflow-y: auto;
  padding-right: 4px;
}

.idea-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 16px 14px 44px;
  background: var(--surface-2);
  transition: border-color 0.2s, box-shadow 0.25s ease, transform 0.2s ease;
}

.idea-card:hover {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.idea-card.is-selected {
  border-color: var(--indigo);
  box-shadow: 0 0 0 2px var(--ring);
}

.idea-card .card-check {
  position: absolute;
  left: 14px;
  top: 18px;
  width: 18px;
  height: 18px;
  accent-color: var(--indigo);
  cursor: pointer;
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-intent-info {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
}
.badge-intent-commercial {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}
.badge-intent-transactional {
  background: rgba(16, 185, 129, 0.18);
  color: #047857;
}
.badge-intent-nav {
  background: rgba(100, 116, 139, 0.2);
  color: #334155;
}

body.dark .badge-intent-info {
  color: #93c5fd;
}
body.dark .badge-intent-commercial {
  color: #fcd34d;
}
body.dark .badge-intent-transactional {
  color: #6ee7b7;
}
body.dark .badge-intent-nav {
  color: #cbd5e1;
}

.badge-cat {
  background: rgba(79, 70, 229, 0.12);
  color: var(--indigo-dark);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

body.dark .badge-cat {
  color: #c7d2fe;
}

.badge-funnel {
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
  text-transform: none;
}

body.dark .badge-funnel {
  background: rgba(255, 255, 255, 0.08);
}

.seo-pill {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.seo-pill--high {
  color: var(--emerald);
  border-color: rgba(5, 150, 105, 0.35);
}

.seo-pill--mid {
  color: var(--amber);
}

.seo-pill--low {
  color: var(--rose);
}

.card-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-meta {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.metrics-row strong {
  color: var(--text);
  font-weight: 600;
}

.slug-line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 10px;
}

.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag-chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions .btn-sm {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.card-actions .btn-sm:hover {
  border-color: rgba(79, 70, 229, 0.45);
  background: rgba(79, 70, 229, 0.06);
}

.card-actions .btn-sm.btn-sm--primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.tool-extra-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tool-toggle-btn {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.tool-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.right-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.right-tab {
  flex: 1;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.right-tab.is-active {
  background: rgba(79, 70, 229, 0.12);
  color: var(--indigo-dark);
  border-color: rgba(79, 70, 229, 0.2);
}

body.dark .right-tab.is-active {
  color: #e0e7ff;
  background: rgba(99, 102, 241, 0.2);
}

.right-panel.hidden {
  display: none;
}

.saved-scroll {
  max-height: min(52vh, 560px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.saved-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface-2);
  transition: box-shadow 0.2s;
}

.saved-item:hover {
  box-shadow: var(--shadow);
}

.saved-item.is-fav {
  border-color: rgba(245, 158, 11, 0.45);
}

.saved-date {
  font-size: 11px;
  color: var(--muted);
}

.saved-title {
  font-weight: 700;
  font-size: 14px;
  margin: 4px 0 6px;
}

.saved-snippet {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.saved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.saved-actions button {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
}

.history-session {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface-2);
}

.history-session h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.history-session p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.stat-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-card {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.stat-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.stats-footnote {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.5;
}

.advanced {
  font-size: 13px;
  color: var(--muted);
}

.advanced-note {
  margin: 0;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.history-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

/* Modal preview */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 20px;
}

.modal.is-open,
.modal[style*="flex"] {
  display: flex;
}

.modal-content {
  position: relative;
  background: var(--surface);
  color: var(--text);
  padding: 24px;
  border-radius: 18px;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  animation: pop 0.25s ease;
}

.modal-content--wide {
  max-width: 720px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: var(--surface-2);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.modal-heading {
  margin: 0 0 16px;
  padding-right: 40px;
  font-size: 1.25rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.modal-span2 {
  grid-column: span 2;
}

.modal-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.modal-block {
  margin: 0;
  font-size: 15px;
}

.modal-block.muted {
  color: var(--muted);
}

.modal-block.mono {
  font-family: var(--mono);
  font-size: 13px;
}

.modal-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-chip {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

@keyframes pop {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Legal popup */
.legal-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  padding: 20px;
}

.legal-popup-overlay.is-dismissed {
  display: none;
}

.legal-popup-box {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
}

.legal-popup-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legal-popup-box h3 {
  margin: 0 0 10px;
}

.legal-popup-box p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.legal-popup-box button {
  margin-top: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  background: var(--indigo);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* Popups embed / similar */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 15000;
  padding: 20px;
}

.popup-overlay.active {
  display: flex;
}

.popup-box {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
}

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.embed-box textarea {
  min-height: 140px;
  font-family: var(--mono);
  font-size: 12px;
}

.copy-btn {
  margin-top: 12px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: var(--emerald);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.similar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.similar-list li {
  margin-bottom: 8px;
}

.similar-list a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: background 0.15s;
}

.similar-list a:hover {
  background: var(--surface-2);
}

/* Toast */
.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 25000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  font-size: 14px;
  font-weight: 500;
  animation: fadeUp 0.3s ease;
}

body.dark .toast {
  background: #1e293b;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.45);
  border-radius: 999px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* Tablet & below: one column — sidebar, workspace, sidebar stacked */
@media (max-width: 1024px) {
  .app-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }

  .sidebar-left,
  .sidebar-right {
    position: relative;
    top: auto;
    width: 100%;
    max-width: none;
  }

  .main-content {
    width: 100%;
    min-width: 0;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .cluster-grid {
    grid-template-columns: 1fr;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-span2 {
    grid-column: span 1;
  }
}

/* Phones: full-width controls, no side-by-side toolbars */
@media (max-width: 640px) {
  .wrapper {
    padding: 12px 12px 24px;
  }

  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions .chip-btn {
    width: 100%;
    justify-content: center;
  }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .theme-toggle {
    justify-content: space-between;
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid var(--border);
  }

  .side-box--row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .cluster-toggle-wrap {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .row-inputs {
    flex-direction: column;
  }

  .row-inputs .btn-icon {
    width: 100%;
    min-height: 44px;
  }

  .right-tabs {
    flex-direction: column;
    gap: 6px;
  }

  .right-tab {
    width: 100%;
    text-align: center;
    padding: 10px 12px;
  }

  .workspace-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .toolbar-left {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .toolbar-left .btn-toolbar {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .toolbar-right {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .status-pill {
    width: 100%;
    text-align: center;
  }

  .idea-list {
    max-height: none;
  }

  .card-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-top .seo-pill {
    margin-left: 0;
  }

  .metrics-row {
    flex-direction: column;
    gap: 6px;
  }

  .card-actions {
    flex-direction: column;
  }

  .card-actions .btn-sm {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .tool-extra-actions {
    flex-direction: column;
  }

  .tool-toggle-btn {
    width: 100%;
    text-align: center;
  }

  .saved-actions {
    flex-direction: column;
  }

  .saved-actions button {
    width: 100%;
    min-height: 44px;
  }

  .modal-content {
    padding: 18px 16px;
    border-radius: 16px;
    max-height: calc(100dvh - 24px);
  }

  .modal-close {
    top: 8px;
    right: 8px;
  }

  .popup-box {
    padding: 20px 16px;
    border-radius: 18px;
  }

  .toast-host {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: none;
    min-width: 0;
    width: 100%;
  }
}
