:root {
  --bg: #070b16;
  --panel: rgba(12, 18, 34, 0.82);
  --panel-solid: #0c1222;
  --ink: #ecf6ff;
  --muted: #94a8c7;
  --line: rgba(119, 247, 255, 0.18);
  --brand: #45d9ff;
  --brand-2: #8b5cf6;
  --brand-3: #42f5b6;
  --danger: #ffbd71;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(69, 217, 255, 0.22), transparent 30%),
    radial-gradient(circle at 78% 8%, rgba(139, 92, 246, 0.22), transparent 28%),
    linear-gradient(135deg, #050814 0%, #08111f 44%, #111827 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(69, 217, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 217, 255, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 86%);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 12, 24, 0.82);
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(69, 217, 255, 0.95);
  background: rgba(8, 16, 31, 0.96);
  box-shadow: 0 0 0 3px rgba(69, 217, 255, 0.16), 0 0 24px rgba(69, 217, 255, 0.12);
}

textarea {
  resize: vertical;
}

label {
  display: block;
  margin: 14px 0 7px;
  color: #c9d8ef;
  font-weight: 800;
  font-size: 14px;
}

.field-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.media-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.media-selected {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.media-selected div {
  border: 1px solid rgba(69, 217, 255, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.media-selected strong,
.media-selected span {
  display: block;
}

.media-selected span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.media-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.media-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.media-card.active {
  border-color: rgba(66, 245, 182, 0.58);
  box-shadow: 0 0 0 3px rgba(66, 245, 182, 0.10);
}

.media-card img {
  width: 100%;
  aspect-ratio: 1.25;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.media-card strong {
  display: block;
  margin: 8px 0;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.media-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.media-actions button {
  min-height: 32px;
  border: 1px solid rgba(69, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(69, 217, 255, 0.08);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.media-actions .danger-action {
  grid-column: 1 / -1;
  border-color: rgba(255, 189, 113, 0.34);
  background: rgba(255, 189, 113, 0.10);
  color: #ffd6ad;
}

.media-actions .danger-action:hover {
  border-color: rgba(255, 189, 113, 0.72);
  background: rgba(255, 189, 113, 0.18);
}

.batch-box {
  margin-top: 20px;
  border: 1px solid rgba(66, 245, 182, 0.20);
  border-radius: 8px;
  padding: 16px;
  background: rgba(66, 245, 182, 0.055);
}

.batch-box h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.panel-head.tight {
  margin-bottom: 10px;
}

.panel-head.tight h3 {
  margin: 2px 0 0;
}

.batch-box .primary {
  margin-top: 14px;
}

.generator-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
  border: 1px solid rgba(69, 217, 255, 0.15);
  border-radius: 8px;
  background: rgba(5, 10, 22, 0.5);
}

.generator-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.generator-table th,
.generator-table td {
  border-bottom: 1px solid rgba(119, 247, 255, 0.12);
  padding: 10px;
  vertical-align: top;
}

.generator-table th {
  color: #bcd0ed;
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
  background: rgba(69, 217, 255, 0.06);
}

.generator-table td:first-child {
  min-width: 210px;
}

.generator-table td:nth-child(2) {
  min-width: 280px;
}

.generator-table input,
.generator-table select,
.generator-table textarea {
  min-height: 40px;
  padding: 9px 10px;
  font-size: 13px;
}

.compact-textarea {
  margin-top: 8px;
}

.compact-textarea.no-margin {
  margin-top: 0;
}

.select-stack {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.select-stack label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.workflow-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 0;
}

.workflow-table-wrap {
  margin-bottom: 16px;
}

.workflow-table {
  min-width: 920px;
}

.toggle-stack {
  display: grid;
  gap: 7px;
  min-width: 130px;
}

.toggle-stack label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.toggle-stack input {
  width: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--brand-3);
}

.legacy-domains {
  margin-top: 14px;
  border: 1px solid rgba(69, 217, 255, 0.14);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(69, 217, 255, 0.045);
}

.legacy-domains summary {
  cursor: pointer;
  color: #dce9ff;
  font-weight: 800;
}

.defaults-panel {
  margin-top: 16px;
  border: 1px solid rgba(119, 247, 255, 0.14);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.defaults-panel summary {
  cursor: pointer;
  color: #dce9ff;
  font-weight: 900;
}

.defaults-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.generator-options {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  border: 1px solid rgba(69, 217, 255, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(69, 217, 255, 0.055);
}

.compact-options {
  margin-bottom: 0;
}

.media-group-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 10px 0 16px;
  border: 1px solid rgba(66, 245, 182, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: rgba(66, 245, 182, 0.052);
}

.group-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.group-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(119, 247, 255, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.group-card strong,
.group-card span {
  display: block;
}

.group-card strong {
  margin-bottom: 6px;
}

.group-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.inline-actions {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

.login-screen {
  overflow-x: hidden;
}

.login-wrap {
  width: min(1180px, calc(100% - 36px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  align-items: center;
  gap: 38px;
  padding: 42px 0;
}

.login-visual {
  min-height: 620px;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(69, 217, 255, 0.08), rgba(139, 92, 246, 0.08)),
    rgba(6, 11, 23, 0.76);
  box-shadow: var(--shadow);
}

.signal-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(66, 245, 182, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(66, 245, 182, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  transform: perspective(700px) rotateX(58deg) translateY(80px);
  transform-origin: bottom;
}

.orbital-card {
  position: relative;
  width: min(520px, 82%);
  padding: 34px;
  border: 1px solid rgba(69, 217, 255, 0.34);
  border-radius: 8px;
  background: rgba(8, 15, 30, 0.78);
  box-shadow: inset 0 0 44px rgba(69, 217, 255, 0.08), 0 0 70px rgba(69, 217, 255, 0.13);
  backdrop-filter: blur(14px);
}

.orbital-card p,
.topbar p {
  margin: 0 0 10px;
  color: var(--brand-3);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: .12em;
}

.orbital-card h1 {
  margin: 0 0 18px;
  max-width: 640px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: .94;
  letter-spacing: 0;
}

.orbital-card span,
.login-copy {
  color: var(--muted);
  line-height: 1.65;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  display: inline-block;
  margin-bottom: 18px;
  background: var(--brand-3);
  box-shadow: 0 0 0 8px rgba(66, 245, 182, 0.12), 0 0 28px rgba(66, 245, 182, 0.8);
}

.login-card,
.panel,
.sidebar {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card {
  border-radius: 8px;
  padding: 28px;
}

.login-brand {
  margin-bottom: 28px;
}

.login-card h2 {
  margin: 0 0 10px;
  font-size: 30px;
}

.login-card .primary {
  width: 100%;
  margin-top: 20px;
}

.login-error {
  margin: 16px 0 4px;
  border: 1px solid rgba(255, 189, 113, 0.34);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 189, 113, 0.10);
  color: #ffd5a8;
}

.account-create-screen {
  min-height: 100vh;
}

.account-create-wrap {
  width: min(100% - 36px, 520px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 42px 0;
}

.account-create-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.account-create-brand {
  margin-bottom: 28px;
}

.account-create-eyebrow {
  margin: 0 0 8px;
  color: var(--brand-3);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.account-create-card h1 {
  margin: 0 0 24px;
  font-size: 32px;
  letter-spacing: 0;
}

.account-security-copy {
  margin: -10px 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.account-create-card form {
  display: grid;
}

.account-create-card .primary {
  width: 100%;
  margin-top: 20px;
}

.account-create-status {
  margin: 0 0 18px;
  border: 1px solid;
  border-radius: 8px;
  padding: 12px;
}

.account-create-status.success {
  border-color: rgba(66, 245, 182, 0.32);
  background: rgba(66, 245, 182, 0.08);
  color: #a7f3d0;
}

.account-create-status.error {
  border-color: rgba(255, 189, 113, 0.34);
  background: rgba(255, 189, 113, 0.10);
  color: #ffd5a8;
}

.account-create-back {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}

.account-create-back:hover {
  color: #fff;
}

.shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  color: #05101c;
  display: inline-grid;
  place-items: center;
  font-weight: 950;
  box-shadow: 0 0 28px rgba(69, 217, 255, 0.34);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.menu {
  display: grid;
  gap: 8px;
}

.menu a,
.menu button,
.logout-form button {
  min-height: 43px;
  border: 1px solid rgba(69, 217, 255, 0.16);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.045);
  color: #eaf7ff;
  text-align: left;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.menu a:hover,
.menu button:hover,
.logout-form button:hover {
  border-color: rgba(69, 217, 255, 0.48);
  background: rgba(69, 217, 255, 0.10);
}

.menu a.active {
  border-color: rgba(66, 245, 182, 0.48);
  background: linear-gradient(135deg, rgba(69, 217, 255, 0.16), rgba(66, 245, 182, 0.08));
  color: #fff;
}

.menu-group {
  display: grid;
  gap: 6px;
}

.menu .menu-group-toggle,
.menu .menu-primary-link {
  min-height: 46px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.055);
}

.menu .menu-group-toggle {
  width: 100%;
  justify-content: space-between;
  cursor: pointer;
}

.menu-group.contains-active > .menu-group-toggle {
  border-color: rgba(66, 245, 182, 0.34);
  color: var(--brand-3);
}

.menu-chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.menu-group.is-open .menu-chevron {
  transform: rotate(225deg);
}

.menu-submenu {
  display: grid;
  gap: 5px;
  margin-left: 12px;
  padding: 2px 0 4px 12px;
  border-left: 1px solid rgba(69, 217, 255, 0.24);
}

.menu-submenu[hidden] {
  display: none;
}

.menu .menu-submenu a,
.menu .menu-submenu button {
  min-height: 37px;
  border-color: transparent;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.menu .menu-submenu a:hover,
.menu .menu-submenu button:hover {
  color: #fff;
  border-color: rgba(69, 217, 255, 0.22);
  background: rgba(69, 217, 255, 0.08);
}

.menu .menu-submenu a.active {
  border-color: rgba(66, 245, 182, 0.26);
  background: rgba(66, 245, 182, 0.09);
  color: #fff;
}

.menu .menu-submenu a.active::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: var(--brand-3);
  box-shadow: 0 0 10px rgba(66, 245, 182, 0.72);
}

.menu .menu-action {
  cursor: pointer;
  color: #b9d9e8;
}

.menu .menu-primary-link {
  justify-content: space-between;
}

.ai-page {
  overflow: hidden;
}

.ai-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-state > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffbd71;
  box-shadow: 0 0 12px rgba(255, 189, 113, 0.58);
}

.ai-state.waiting > span {
  background: var(--brand);
  box-shadow: 0 0 12px rgba(69, 217, 255, 0.52);
}

.ai-state.connected {
  color: #a7f3d0;
}

.ai-state.connected > span {
  background: var(--brand-3);
  box-shadow: 0 0 12px rgba(66, 245, 182, 0.64);
}

.ai-state.error {
  color: #ffd5a8;
}

.ai-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ai-metrics > div {
  min-width: 0;
  padding: 20px;
}

.ai-metrics > div + div {
  border-left: 1px solid var(--line);
}

.ai-metrics small,
.ai-metrics strong {
  display: block;
}

.ai-metrics small {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.ai-metrics strong {
  color: #fff;
  overflow-wrap: anywhere;
}

.ai-empty-state {
  padding: 52px 24px;
  text-align: center;
}

.ai-empty-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(69, 217, 255, 0.32);
  border-radius: 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 950;
  box-shadow: inset 0 0 22px rgba(69, 217, 255, 0.08);
}

.ai-empty-state h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.ai-empty-state p {
  max-width: 520px;
  margin: 0 auto 20px;
  color: var(--muted);
  line-height: 1.6;
}

.ai-connection-form {
  padding: 26px 20px 6px;
}

.ai-form-grid {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(240px, 1fr);
  gap: 18px;
}

.ai-model-field {
  min-width: 0;
}

.ai-custom-model {
  margin-top: 10px;
}

.ai-model-guide {
  display: grid;
  grid-template-columns: .75fr .85fr 1.6fr;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ai-model-guide > div {
  min-width: 0;
  padding: 11px 10px;
}

.ai-model-guide > div + div {
  border-left: 1px solid var(--line);
}

.ai-model-guide small,
.ai-model-guide strong {
  display: block;
}

.ai-model-guide small {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.ai-model-guide strong {
  color: #eaf7ff;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ai-key-field {
  grid-column: 1 / -1;
}

.ai-key-field small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.ai-connection-form .status {
  margin-top: 20px;
}

.ai-connection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.ai-content-engine {
  margin-top: 24px;
  padding: 22px 0 4px;
  border-top: 1px solid rgba(66, 245, 182, 0.24);
}

.ai-content-engine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.ai-content-engine-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.ai-content-toggle {
  min-height: 50px;
  margin: 0 0 14px;
  padding: 0 14px;
  border-left: 3px solid var(--brand-3);
  background: rgba(66, 245, 182, 0.06);
}

.ai-engine-summary {
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.ai-engine-summary small,
.ai-engine-summary strong {
  display: block;
}

.ai-engine-summary small {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.ai-engine-summary strong {
  color: var(--brand-3);
  font-size: 13px;
}

#aiGeneratorHint a {
  color: var(--brand);
  font-weight: 800;
}

.ai-delete-connection {
  margin-left: auto;
  border-color: rgba(255, 189, 113, 0.3);
  color: #ffd5a8;
}

.ai-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ai-flow > div {
  min-width: 0;
  padding: 26px 20px;
}

.ai-flow > div + div {
  border-left: 1px solid var(--line);
}

.ai-flow span,
.ai-flow strong,
.ai-flow small {
  display: block;
}

.ai-flow span {
  margin-bottom: 18px;
  color: var(--brand-3);
  font-size: 12px;
  font-weight: 900;
}

.ai-flow strong {
  margin-bottom: 7px;
  color: #fff;
}

.ai-flow small {
  color: var(--muted);
  line-height: 1.5;
}

.seo-flow-page {
  padding-bottom: 0;
  overflow: hidden;
}

.seo-flow-editor {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  margin: 22px -22px 0;
  border-top: 1px solid var(--line);
}

.seo-flow-input-pane {
  min-width: 0;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(5, 13, 25, 0.42);
}

.seo-flow-input-head,
.seo-flow-toolbar,
.seo-flow-stats,
.seo-flow-controls,
.seo-flow-input-actions {
  display: flex;
  align-items: center;
}

.seo-flow-input-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.seo-flow-input-head label {
  margin: 0 0 4px;
  color: #f4f8ff;
  font-size: 15px;
}

.seo-flow-input-head small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.seo-flow-import {
  min-height: 38px;
  margin: 0;
  padding: 0 13px;
  white-space: nowrap;
  cursor: pointer;
}

#seoFlowInput {
  min-height: 270px;
  resize: vertical;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
}

.seo-flow-input-pane .status {
  min-height: 66px;
  margin: 14px 0;
  font-size: 12px;
}

.seo-flow-input-actions {
  flex-wrap: wrap;
  gap: 9px;
}

.seo-flow-input-actions button {
  min-height: 40px;
}

.seo-flow-visual-pane {
  min-width: 0;
  background: #07111f;
}

.seo-flow-toolbar {
  min-height: 66px;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 23, 40, 0.92);
}

.seo-flow-stats {
  flex-wrap: wrap;
  gap: 9px;
}

.seo-flow-stats span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(69, 217, 255, 0.15);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(69, 217, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
}

.seo-flow-stats strong {
  color: var(--brand-3);
  font-size: 15px;
}

.seo-flow-controls {
  flex-shrink: 0;
  gap: 7px;
}

.seo-flow-controls > button:not(.secondary) {
  width: 40px;
  height: 38px;
  border: 1px solid rgba(69, 217, 255, 0.2);
  border-radius: 7px;
  background: rgba(69, 217, 255, 0.07);
  color: var(--brand);
  font-weight: 900;
}

#seoFlowZoomReset {
  width: 58px;
  font-size: 11px;
}

.seo-flow-controls .secondary {
  min-height: 38px;
  margin-left: 4px;
  white-space: nowrap;
}

.seo-flow-export-format {
  width: auto;
  min-height: 38px;
  padding: 0 34px 0 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.seo-flow-canvas {
  position: relative;
  min-height: 550px;
  max-height: 680px;
  overflow: auto;
  background:
    linear-gradient(rgba(69, 217, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 217, 255, 0.025) 1px, transparent 1px),
    #07111f;
  background-size: 28px 28px;
}

.seo-flow-canvas svg {
  display: block;
  max-width: none;
  transform-origin: top left;
}

.seo-flow-empty {
  position: absolute;
  inset: 0;
  min-height: 550px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  text-align: center;
}

.seo-flow-empty .ai-empty-mark {
  margin-bottom: 18px;
}

.seo-flow-empty h3 {
  margin: 0 0 8px;
  font-size: 19px;
}

.seo-flow-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1080px) {
  .seo-flow-editor {
    grid-template-columns: 1fr;
  }

  .seo-flow-input-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .ai-metrics,
  .ai-flow,
  .ai-form-grid,
  .ai-model-guide {
    grid-template-columns: 1fr;
  }

  .ai-metrics > div + div,
  .ai-flow > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .ai-key-field {
    grid-column: auto;
  }

  .ai-model-guide > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .ai-connection-actions {
    display: grid;
  }

  .ai-delete-connection {
    margin-left: 0;
  }

  .seo-flow-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .seo-flow-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .seo-flow-controls .secondary {
    margin-left: auto;
  }

  .seo-flow-input-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .seo-flow-input-actions .primary {
    grid-column: 1 / -1;
  }

  .seo-flow-canvas,
  .seo-flow-empty {
    min-height: 470px;
  }
}

.side-note {
  margin-top: auto;
  border: 1px solid rgba(66, 245, 182, 0.22);
  border-radius: 8px;
  padding: 16px;
  background: rgba(66, 245, 182, 0.06);
}

.side-note span {
  display: block;
  font-size: 32px;
  font-weight: 950;
  color: var(--brand-3);
}

.side-note small {
  color: var(--muted);
}

.account-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(69, 217, 255, 0.16);
}

.account-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(66, 245, 182, 0.34);
  border-radius: 8px;
  background: rgba(66, 245, 182, 0.09);
  color: var(--brand-3);
  font-weight: 900;
}

.account-summary small,
.account-summary strong {
  display: block;
}

.account-security-link {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(69, 217, 255, 0.18);
  border-radius: 8px;
  background: rgba(69, 217, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.account-security-link:hover {
  border-color: rgba(66, 245, 182, 0.4);
  color: #fff;
}

.account-summary small {
  color: var(--muted);
  font-size: 11px;
}

.account-summary strong {
  margin-top: 2px;
  color: #fff;
  font-size: 13px;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  width: 100%;
  justify-content: center;
  color: #ffd5a8;
}

.workspace {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: 0;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  align-items: start;
}

.panel {
  border-radius: 8px;
}

form.panel {
  padding: 8px 0;
}

.compact {
  padding: 20px;
}

.form-section {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 18px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.section-number {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: rgba(69, 217, 255, 0.10);
  color: var(--brand);
  font-weight: 950;
  border: 1px solid rgba(69, 217, 255, 0.22);
}

h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.checkline {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0 0;
  font-weight: 700;
  color: var(--muted);
}

.checkline input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.actions {
  padding: 20px 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary,
.secondary,
.icon {
  min-height: 43px;
  border: 0;
  border-radius: 8px;
  font-weight: 950;
}

.primary {
  padding: 0 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 12px 28px rgba(69, 217, 255, 0.18);
}

.primary.dark {
  background: linear-gradient(135deg, #172033, #263554);
  border: 1px solid rgba(69, 217, 255, 0.18);
}

.primary.glow {
  box-shadow: 0 0 26px rgba(69, 217, 255, 0.28), 0 16px 40px rgba(139, 92, 246, 0.22);
}

.secondary {
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--line);
}

.icon {
  width: 42px;
  background: rgba(69, 217, 255, 0.10);
  color: var(--brand);
  border: 1px solid rgba(69, 217, 255, 0.22);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head h2,
.output h2 {
  margin: 0;
}

.project-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.project-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  text-align: left;
}

.project-card.active {
  border-color: rgba(69, 217, 255, 0.78);
  box-shadow: 0 0 0 3px rgba(69, 217, 255, 0.12), 0 0 24px rgba(69, 217, 255, 0.10);
}

.project-card strong,
.project-card span {
  display: block;
}

.project-card strong {
  overflow-wrap: anywhere;
}

.project-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.output {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.status {
  margin: 14px 0;
  border: 1px solid rgba(148, 168, 199, 0.14);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  line-height: 1.5;
}

.status.ok {
  color: #a7ffd9;
  border-color: rgba(66, 245, 182, 0.22);
  background: rgba(66, 245, 182, 0.08);
}

.status.warn {
  color: #ffd5a8;
  border-color: rgba(255, 189, 113, 0.24);
  background: rgba(255, 189, 113, 0.08);
}

.links {
  display: grid;
  gap: 8px;
}

.links a {
  color: var(--brand);
  overflow-wrap: anywhere;
  font-weight: 850;
}

.page-panel {
  margin-top: 22px;
  padding: 22px;
}

.download-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--brand-3), var(--brand));
  color: #05101c;
  text-decoration: none;
  font-weight: 950;
}

.download-button.subtle {
  border: 1px solid rgba(69, 217, 255, 0.18);
  background: rgba(69, 217, 255, 0.08);
  color: var(--brand);
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.result-list,
.history-list,
.workflow-results {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.result-card,
.history-row,
.workflow-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.result-card strong,
.result-card span,
.history-row strong,
.history-row span,
.workflow-card strong,
.workflow-card span {
  display: block;
}

.result-card span,
.history-row span,
.workflow-card span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.workflow-card {
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, auto) auto;
}

.workflow-card.warning {
  border-color: rgba(255, 189, 113, 0.34);
  background: rgba(255, 189, 113, 0.06);
}

.workflow-card p {
  margin: 8px 0 0;
  color: #dce9ff;
  font-size: 13px;
  line-height: 1.5;
}

.workflow-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.workflow-badges span {
  margin: 0;
  border: 1px solid rgba(66, 245, 182, 0.18);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(66, 245, 182, 0.06);
  color: #bdfbe3;
  font-weight: 800;
}

.workflow-domain-file {
  justify-content: flex-start;
}

.result-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.result-links a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(69, 217, 255, 0.18);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 850;
}

.menu-count {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  border: 1px solid rgba(255, 189, 113, 0.38);
  border-radius: 50%;
  background: rgba(255, 189, 113, 0.12);
  color: #ffd5a8;
  font-size: 11px;
  font-weight: 950;
}

.finishing-layout {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 20px;
}

.finishing-layout > aside {
  position: sticky;
  top: 22px;
  max-height: calc(100vh - 44px);
  overflow: auto;
  border-right: 1px solid var(--line);
  padding-right: 16px;
}

.finishing-queue-head,
.audit-section-head,
.finishing-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.finishing-queue-head span {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(69, 217, 255, 0.1);
  color: var(--brand);
  font-weight: 900;
}

.finishing-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.finishing-queue-item {
  width: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "state title" "state meta";
  gap: 4px 10px;
  align-items: center;
  border: 1px solid rgba(148, 168, 199, 0.15);
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
}

.finishing-queue-item:hover,
.finishing-queue-item.active {
  border-color: rgba(69, 217, 255, 0.46);
  background: rgba(69, 217, 255, 0.075);
}

.finishing-queue-item strong {
  grid-area: title;
  overflow-wrap: anywhere;
}

.finishing-queue-item small {
  grid-area: meta;
  color: var(--muted);
  line-height: 1.4;
}

.audit-state {
  grid-area: state;
  min-width: 50px;
  padding: 6px;
  border-radius: 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.audit-state.pass,
.audit-score.pass {
  color: #a7ffd9;
  background: rgba(66, 245, 182, 0.1);
}

.audit-state.fail,
.audit-score.fail {
  color: #ffd5a8;
  background: rgba(255, 189, 113, 0.1);
}

.finishing-detail {
  min-width: 0;
}

.finishing-titlebar {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.finishing-titlebar p,
.finishing-titlebar h3,
.finishing-titlebar span,
.audit-section h3,
.approval-panel p {
  margin: 0;
}

.finishing-titlebar p {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.finishing-titlebar h3 {
  margin-top: 4px;
  font-size: 25px;
}

.finishing-titlebar > div > span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.audit-score {
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
}

.audit-identity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.audit-identity-grid > div {
  min-width: 0;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
}

.audit-identity-grid > div:last-child {
  border-right: 0;
}

.audit-identity-grid span,
.audit-identity-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.audit-identity-grid span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 850;
}

.audit-identity-grid strong {
  margin-top: 6px;
  font-size: 13px;
}

.audit-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.audit-section-head a,
.audit-section-head > span,
.preview-links a,
.action-link {
  color: var(--brand);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.audit-media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.audit-media-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.035);
}

.audit-media-item img,
.media-placeholder {
  width: 64px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(148, 168, 199, 0.08);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.audit-media-item strong,
.audit-media-item small {
  display: block;
}

.audit-media-item small {
  margin-top: 4px;
  color: var(--muted);
}

.audit-media-item.missing {
  border-color: rgba(255, 189, 113, 0.3);
}

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

.audit-check {
  min-height: 78px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(148, 168, 199, 0.14);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.audit-check.pass {
  border-color: rgba(66, 245, 182, 0.2);
}

.audit-check.fail {
  border-color: rgba(255, 189, 113, 0.28);
}

.audit-check-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(148, 168, 199, 0.1);
  font-size: 11px;
  font-weight: 950;
}

.audit-check.pass .audit-check-mark {
  color: #a7ffd9;
  background: rgba(66, 245, 182, 0.1);
}

.audit-check.fail .audit-check-mark {
  color: #ffd5a8;
  background: rgba(255, 189, 113, 0.1);
}

.audit-check strong,
.audit-check p {
  display: block;
  margin: 0;
}

.audit-check p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.preview-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: rgba(6, 12, 24, 0.75);
}

.preview-switch button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 11px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.preview-switch button.active {
  background: rgba(69, 217, 255, 0.13);
  color: var(--brand);
}

.preview-section iframe {
  width: 100%;
  height: clamp(480px, 66vh, 760px);
  margin-top: 14px;
  border: 1px solid rgba(148, 168, 199, 0.24);
  border-radius: 8px;
  background: #fff;
}

.preview-links {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.approval-panel {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  border: 1px solid rgba(66, 245, 182, 0.25);
  border-radius: 8px;
  padding: 18px;
  background: rgba(66, 245, 182, 0.06);
}

.approval-panel.has-findings {
  border-color: rgba(255, 189, 113, 0.32);
  background: rgba(255, 189, 113, 0.06);
}

.approval-panel p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.approval-check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 0;
  color: var(--ink);
}

.approval-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 2px 0 0;
}

.approval-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
}

.approval-actions button,
.approval-actions .action-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 14px;
}

.approval-actions .action-link {
  border: 1px solid var(--line);
  color: var(--ink);
}

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

@media (max-width: 1080px) {
  .login-wrap,
  .shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 420px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .finishing-layout {
    grid-template-columns: 1fr;
  }

  .finishing-layout > aside {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 16px;
  }

  .finishing-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .login-wrap {
    width: min(100% - 28px, 460px);
  }

  .login-visual {
    display: none;
  }

  .topbar,
  .media-selected,
  .media-upload,
  .media-group-builder,
  .defaults-grid,
  .result-card,
  .group-card,
  .history-row,
  .workflow-card,
  .two {
    grid-template-columns: 1fr;
    display: grid;
  }

  .result-links {
    justify-content: flex-start;
  }

  .form-section {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .audit-identity-grid,
  .audit-media-grid,
  .audit-check-list {
    grid-template-columns: 1fr;
  }

  .audit-identity-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .finishing-titlebar,
  .audit-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .approval-actions > * {
    width: 100%;
  }
}
