.achlaai-admin {
  --achla-primary: #0b5cab;
  --achla-success: #16794a;
  --achla-warning: #8a4b08;
  --achla-danger: #b42318;
  --achla-border: #c3c4c7;
  --achla-surface: #ffffff;
  --achla-muted: #50575e;
  max-width: 960px;
  color: #1d2327;
  letter-spacing: 0;
}

.achlaai-admin .achlaai-lead {
  max-width: 68ch;
  color: var(--achla-muted);
  font-size: 15px;
  line-height: 1.6;
}

.achlaai-panel {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--achla-border);
  border-radius: 6px;
  background: var(--achla-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.achlaai-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.achlaai-panel h2,
.achlaai-panel h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.achlaai-panel h3 {
  font-size: 14px;
}

.achlaai-panel-head p {
  max-width: 68ch;
  margin: 4px 0 0;
  color: var(--achla-muted);
  line-height: 1.55;
}

.achlaai-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #a7aaad;
  border-radius: 4px;
  background: #f6f7f7;
  color: #2c3338;
  font-weight: 600;
  white-space: nowrap;
}

.achlaai-status[data-status="verified"] {
  border-color: #7bc99c;
  background: #edfaF2;
  color: #0d5c38;
}

.achlaai-status[data-status="needs_reverification"],
.achlaai-status[data-status="legacy_reconnect_required"] {
  border-color: #e0a46c;
  background: #fff7ed;
  color: #78420a;
}

.achlaai-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 20px;
  overflow: hidden;
  border: 1px solid #dcdcde;
  border-radius: 4px;
  background: #dcdcde;
}

.achlaai-facts > div {
  min-width: 0;
  padding: 14px;
  background: #f9f9f9;
}

.achlaai-facts dt {
  margin-bottom: 4px;
  color: var(--achla-muted);
  font-size: 12px;
  font-weight: 600;
}

.achlaai-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.achlaai-actions,
.achlaai-input-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.achlaai-admin .button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-right: 16px;
  padding-left: 16px;
}

.achlaai-admin .button .dashicons {
  width: 18px;
  height: 18px;
  font-size: 18px;
}

.achlaai-admin .button:focus-visible,
.achlaai-admin input:focus-visible {
  outline: 3px solid rgba(11, 92, 171, 0.35);
  outline-offset: 2px;
}

.achlaai-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--achla-muted);
}

.achlaai-progress[hidden] {
  display: none;
}

.achlaai-progress .spinner {
  float: none;
  margin: 0;
}

.achlaai-toggle {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-weight: 600;
}

.achlaai-toggle input,
.achlaai-modes input {
  width: 20px;
  height: 20px;
  margin: 0;
}

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

.achlaai-modes label {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #a7aaad;
  border-radius: 4px;
  background: #f6f7f7;
  cursor: pointer;
}

.achlaai-modes label:has(input:checked) {
  border-color: var(--achla-primary);
  background: #eef6ff;
  color: #063d72;
}

.achlaai-field,
.achlaai-inline-help,
.achlaai-preview {
  margin-top: 18px;
}

.achlaai-field > label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.achlaai-input-action input {
  min-height: 44px;
  flex: 1 1 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.achlaai-preview {
  padding-top: 18px;
  border-top: 1px solid #dcdcde;
}

#achlaai-preview-canvas {
  position: relative;
  min-height: 112px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  background: #f0f0f1;
}

#achlaai-preview-canvas span {
  position: absolute;
  display: block;
  border: 2px solid var(--achla-primary);
  background: #ffffff;
}

#achlaai-preview-canvas[data-mode="bubble"] span {
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

#achlaai-preview-canvas[data-mode="inline"] span {
  top: 24px;
  right: 16px;
  left: 16px;
  height: 62px;
  border-radius: 4px;
}

#achlaai-preview-canvas[data-mode="attach"] span {
  top: 34px;
  left: 16px;
  width: min(320px, calc(100% - 32px));
  height: 42px;
  border-radius: 4px;
}

.achlaai-persistent-warning {
  margin: 16px 0 0;
}

@media (max-width: 782px) {
  .achlaai-panel {
    padding: 18px;
  }

  .achlaai-panel-head {
    flex-direction: column;
  }

  .achlaai-facts,
  .achlaai-modes {
    grid-template-columns: 1fr;
  }

  .achlaai-admin .button,
  .achlaai-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .achlaai-admin *,
  .achlaai-admin *::before,
  .achlaai-admin *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
