.site-element-picker-button {
  direction: rtl;
}

.site-element-picker-attachment {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  max-width: min(720px, calc(100vw - 40px));
  margin: 0 auto 8px;
  padding: 9px 12px;
  border: 1px solid rgba(37, 64, 143, 0.28);
  border-radius: 14px;
  background: rgba(37, 64, 143, 0.08);
  color: var(--text-primary, #111827);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.site-element-picker-attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.site-element-picker-attachment-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.site-element-picker-attachment-row[data-role="reference"] .site-element-picker-attachment-icon {
  background: #7c3aed;
}

.site-element-picker-attachment-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 999px;
  background: #25408f;
  color: #fff;
  font-size: 14px;
}

.site-element-picker-attachment-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-element-picker-attachment-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
}

.site-element-picker-attachment-remove:hover {
  background: rgba(37, 64, 143, 0.14);
}

.site-element-picker-intent {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 7px;
  border-top: 1px dashed rgba(37, 64, 143, 0.22);
}

.site-element-picker-intent-select,
.site-element-picker-intent-input {
  height: 30px;
  border: 1px solid rgba(37, 64, 143, 0.30);
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  padding: 0 9px;
  font-size: 12.5px;
  font-family: inherit;
}

.site-element-picker-intent-select {
  font-weight: 600;
  cursor: pointer;
}

.site-element-picker-intent-input {
  flex: 1 1 160px;
  min-width: 120px;
}

html[data-theme="dark"] .site-element-picker-intent {
  border-top-color: rgba(96, 165, 250, 0.30);
}

html[data-theme="dark"] .site-element-picker-intent-select,
html[data-theme="dark"] .site-element-picker-intent-input {
  background: #0b1220;
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.35);
}

.site-element-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  direction: rtl;
}

.site-element-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(2px);
}

.site-element-picker-panel {
  position: absolute;
  inset: 28px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 20px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
}

.site-element-picker-header,
.site-element-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  background: #fff;
}

.site-element-picker-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.28);
  border-bottom: 0;
  font-size: 13px;
}

.site-element-picker-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.site-element-picker-title strong {
  font-size: 15px;
}

.site-element-picker-title span,
.site-element-picker-status {
  color: #64748b;
  font-size: 12px;
}

.site-element-picker-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-element-picker-actions button,
.site-element-picker-actions select {
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  padding: 0 10px;
  font-size: 13px;
}

.site-element-picker-actions button {
  cursor: pointer;
}

.site-element-picker-actions button.is-active {
  border-color: #25408f;
  background: #25408f;
  color: #fff;
}

.site-element-picker-close {
  width: 34px;
  padding: 0;
  font-size: 20px;
}

.site-element-picker-subbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  background: #fff;
}

.site-element-picker-subbar input {
  flex: 1 1 auto;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  padding: 0 10px;
  font-size: 13px;
}

.site-element-picker-subbar button {
  height: 34px;
  border: 1px solid #25408f;
  border-radius: 10px;
  background: #25408f;
  color: #fff;
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.site-element-picker-subbar button:disabled {
  opacity: 0.6;
  cursor: default;
}

.site-element-picker-capture-status {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  max-width: 38%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-element-picker-capture-status.is-error {
  color: #dc2626;
}

.site-element-picker-body {
  min-height: 0;
  background: #e2e8f0;
}

.site-element-picker-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.site-element-picker-empty {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 28px;
  text-align: center;
  color: #475569;
}

.site-element-picker-selected {
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .site-element-picker-attachment {
  border-color: rgba(96, 165, 250, 0.34);
  background: rgba(30, 64, 175, 0.22);
  color: #e5e7eb;
}

html[data-theme="dark"] .site-element-picker-panel,
html[data-theme="dark"] .site-element-picker-header,
html[data-theme="dark"] .site-element-picker-footer,
html[data-theme="dark"] .site-element-picker-subbar,
html[data-theme="dark"] .site-element-picker-subbar input,
html[data-theme="dark"] .site-element-picker-actions button,
html[data-theme="dark"] .site-element-picker-actions select {
  background: #111827;
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.35);
}

html[data-theme="dark"] .site-element-picker-body {
  background: #020617;
}

@media (max-width: 760px) {
  .site-element-picker-panel {
    inset: 8px;
    border-radius: 16px;
  }

  .site-element-picker-header,
  .site-element-picker-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .site-element-picker-selected {
    max-width: 100%;
  }
}
